#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110;
string s[MAXN];
map<string, bool> mp;
map<string, bool>::iterator it;
int n, num;
int r[MAXN];
bool vis[11], ok[11], su[MAXN];
vector<int> v[11];
inline int get(char a) {
  if (a == 'R') return 6;
  if (a == 'G') return 7;
  if (a == 'B') return 8;
  if (a == 'Y') return 9;
  return 10;
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < 11; i++) v[i].clear();
    mp.clear();
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      mp[s[i]] = 1;
    }
    num = 0;
    for (it = mp.begin(); it != mp.end(); it++) {
      s[num++] = (*it).first;
    }
    memset(vis, 0, sizeof vis);
    for (int i = 0; i < num; i++) {
      int x = get(s[i][0]), y = s[i][1] - '0';
      v[x].push_back(i);
      v[y].push_back(i);
      vis[x] = vis[y] = 1;
    }
    int ans = 1000, all = (1 << 10);
    for (int i = 0; i < all; i++) {
      memset(ok, 0, sizeof ok);
      int cnt = 0;
      for (int j = 0; j < 10; j++) {
        if (i & (1 << j)) {
          if (!vis[j + 1]) {
            cnt = -1;
          } else {
            cnt++;
            ok[j + 1] = 1;
          }
        }
        if (cnt == -1) break;
      }
      if (ans <= cnt || cnt == -1) continue;
      memset(r, 0, sizeof r);
      memset(su, 0, sizeof su);
      for (int j = 1; j < 11; j++) {
        if (ok[j]) {
          int s = v[j].size();
          for (int k = 0; k < s; k++) r[v[j][k]]++;
        }
      }
      for (int j = 0; j < num; j++) su[j] = (r[j] == 2);
      while (1) {
        int tag = 1;
        for (int j = 1; j < 11; j++) {
          if (!ok[j]) continue;
          int id, nn = 0, s = v[j].size();
          for (int k = 0; k < s; k++) {
            if (r[v[j][k]] <= 1) {
              nn++;
              id = k;
            }
          }
          if (nn == 1) {
            tag = 0;
            su[v[j][id]] = 1;
            r[v[j][id]] = 2;
          }
        }
        if (tag) break;
      }
      int rr = 0;
      for (int j = 0; j < num; j++) rr += (su[j] == 1);
      if (rr >= num - 1) ans = cnt;
    }
    printf("%d\n", ans);
  }
  return 0;
}
