#include <bits/stdc++.h>
using namespace std;
int ANS = 1000;
int N;
vector<string> nal;
vector<string> out;
char C[] = "RGBYW";
char V[] = "12345";
bool fine(char a, char b) {
  if (b == '?') return true;
  return a == b;
}
bool OK(const string& a, const string& b) {
  return fine(a[0], b[0]) && fine(a[1], b[1]);
}
int main() {
  cin >> N;
  nal.resize(N);
  for (int i = 0; i < N; ++i) cin >> nal[i];
  for (int m1 = 0; m1 < (1 << 5); ++m1)
    for (int m2 = 0; m2 < (1 << 5); ++m2) {
      out.resize(N);
      fill(out.begin(), out.end(), "??");
      for (int i = 0; i < 5; ++i)
        if (m1 & (1 << i))
          for (int j = 0; j < ((int)(nal).size()); ++j)
            if (nal[j][0] == C[i]) out[j][0] = C[i];
      for (int i = 0; i < 5; ++i)
        if (m2 & (1 << i))
          for (int j = 0; j < ((int)(nal).size()); ++j)
            if (nal[j][1] == V[i]) out[j][1] = V[i];
      map<string, int> cnt;
      for (int i = 0; i < ((int)(nal).size()); ++i) ++cnt[nal[i]];
      int BAD = 0;
      for (int i = 0;; ++i) {
        if (((int)(out).size()) == 0) break;
        i %= ((int)(out).size());
        vector<string> cand;
        for (map<string, int>::iterator it = cnt.begin(); it != cnt.end(); ++it)
          if (OK(it->first, out[i])) {
            cand.push_back(it->first);
            if (((int)(cand).size()) > 1) break;
          }
        if (((int)(cand).size()) == 1) {
          --cnt[cand[0]];
          if (cnt[cand[0]] == 0) cnt.erase(cand[0]);
          out.erase(out.begin() + i);
          BAD = 0;
        } else {
          ++BAD;
          if (BAD > ((int)(out).size())) break;
        }
      }
      if (((int)(cnt).size()) == 0)
        (ANS) = min((ANS), (__builtin_popcount(m1) + __builtin_popcount(m2)));
    }
  cout << ANS << '\n';
  return 0;
}
