#include <bits/stdc++.h>
using namespace std;
int n;
int a[25];
int num[2111];
void init() {
  memset(num, 0, sizeof(num));
  for (int i = 0; i < (1 << 10); ++i) {
    for (int k = 1; k <= i; k *= 2) {
      if (k & i) num[i]++;
    }
  }
}
bool solve(int st) {
  bool ans = true;
  for (int i = 0; i < 25; ++i) {
    if (!a[i]) continue;
    for (int j = i + 1; j < 25; ++j) {
      if (!a[j]) continue;
      if (i / 5 != j / 5) {
        if (((1 << (i / 5)) & st) || ((1 << (j / 5)) & st)) continue;
      }
      if (i % 5 != j % 5) {
        if (((1 << (i % 5 + 5)) & st) || ((1 << (j % 5 + 5)) & st)) continue;
      }
      ans = false;
    }
  }
  return ans;
}
int main() {
  init();
  while (cin >> n) {
    memset(a, 0, sizeof(a));
    for (int i = 0; i < n; ++i) {
      char str[5];
      cin >> str;
      int t = 0;
      t += (str[1] - '1');
      int tt = 0;
      switch (str[0]) {
        case 'R':
          tt = 0;
          break;
        case 'G':
          tt = 1;
          break;
        case 'B':
          tt = 2;
          break;
        case 'Y':
          tt = 3;
          break;
        case 'W':
          tt = 4;
          break;
        default:
          break;
      }
      t += tt * 5;
      a[t]++;
    }
    int ans = 10;
    for (int i = 0; i < 1024; ++i)
      if (solve(i)) ans = min(ans, num[i]);
    cout << ans << endl;
  }
  return 0;
}
