#include <bits/stdc++.h>
using namespace std;
const int N = 6;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
using namespace std;
bool card[N][N];
struct CardChecker {
  bool judge(int x, int y) {
    for (int i = 0; i < 5; ++i)
      for (int j = 0; j < 5; ++j)
        if (card[i][j]) {
          for (int l = 0; l < 5; ++l)
            for (int r = 0; r < 5; ++r)
              if (card[l][r] && (l != i || r != j)) {
                bool flag = true;
                if (l != i && (x & (1 << i)) + (x & (1 << l)) > 0) flag = false;
                if (r != j && (y & (1 << j)) + (y & (1 << r)) > 0) flag = false;
                if (flag) return false;
              }
        }
    return true;
  }
} checker;
string s;
char get(char x) {
  switch (x) {
    case 'R':
      return '1';
    case 'G':
      return '2';
    case 'B':
      return '3';
    case 'Y':
      return '4';
    case 'W':
      return '5';
  }
  return 0;
}
int CountBits(int x) {
  int ret = 0;
  while (x) {
    if (x & 1) ++ret;
    x >>= 1;
  }
  return ret;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> s;
    card[get(s[0]) - '1'][s[1] - '1'] = true;
  }
  int ans = INF, cnt;
  for (int i = 0; i < 32; ++i)
    for (int j = 0; j < 32; ++j)
      if (checker.judge(i, j)) {
        ans = min(ans, CountBits(i) + CountBits(j));
      }
  cout << ans << endl;
  return 0;
}
