#include <bits/stdc++.h>
using namespace std;
map<char, int> M;
int countbits(int n) {
  int ret = 0;
  while (n) {
    if (n % 2) ret++;
    n /= 2;
  }
  return ret;
}
int check(char c, int n) {
  n /= pow(2, M[c]);
  return n % 2;
}
void setmap() {
  M['1'] = 0;
  M['2'] = 1;
  M['3'] = 2;
  M['4'] = 3;
  M['5'] = 4;
  M['R'] = 5;
  M['G'] = 6;
  M['B'] = 7;
  M['Y'] = 8;
  M['W'] = 9;
}
int main() {
  int n, i, ans, flag, j, k;
  cin >> n;
  string s[n];
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }
  setmap();
  ans = 2000000000;
  for (i = 0; i < 1024; i++) {
    flag = 0;
    for (j = 0; j < n; j++) {
      for (k = j + 1; k < n; k++) {
        if (s[j] == s[k]) {
          continue;
        } else if (s[j][0] == s[k][0]) {
          if (!check(s[j][1], i) && !check(s[k][1], i)) {
            flag = 1;
            break;
          }
        } else if (s[j][1] == s[k][1]) {
          if (!check(s[j][0], i) && !check(s[k][0], i)) {
            flag = 1;
            break;
          }
        } else {
          if (!check(s[j][1], i) && !check(s[k][1], i) && !check(s[j][0], i) &&
              !check(s[k][0], i)) {
            flag = 1;
            break;
          }
        }
      }
      if (flag) break;
    }
    if (!flag) {
      ans = min(ans, countbits(i));
    }
  }
  cout << ans << endl;
  return 0;
}
