#include <bits/stdc++.h>
using namespace std;
pair<int, int> ar[105];
int n;
int c[500];
int use[105];
int numOf[105];
int cp[105];
int ok[105];
int vis[15][15];
void read() {
  int m = 0;
  char str[50];
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", str);
    if (vis[c[str[0]]][str[1] - '0']) continue;
    vis[c[str[0]]][str[1] - '0'] = 1;
    ar[++m] = make_pair(c[str[0]], str[1] - '0');
    numOf[ar[m].first]++;
    numOf[ar[m].second]++;
  }
  n = m;
  return;
}
bool check(int b) {
  int i;
  memset(ok, 0, sizeof ok);
  for (i = 1; i <= 10; i++) cp[i] = numOf[i];
  while (1) {
    int flag = 0;
    for (i = 1; i <= n; i++)
      if (!ok[i])
        if ((use[ar[i].first] && use[ar[i].second]) ||
            (use[ar[i].first] && cp[ar[i].first] == 1) ||
            (use[ar[i].second] && cp[ar[i].second] == 1)) {
          ok[i] = 1;
          cp[ar[i].first]--;
          cp[ar[i].second]--;
          flag = 1;
        }
    if (flag == 0) break;
  }
  pair<int, int> p(0, 0);
  for (i = 1; i <= n; i++)
    if (ok[i] == 0) {
      if (p.first == 0)
        p = ar[i];
      else if (p != ar[i])
        return 0;
    }
  return 1;
}
void solve() {
  int b, cnt, i;
  int ans = 10;
  for (b = 0; b < 1024; b++) {
    cnt = 0;
    for (i = 1; i <= 10; i++)
      if (b & (1 << (i - 1)))
        use[i] = 1, cnt++;
      else
        use[i] = 0;
    if (check(b)) ans = ((ans) < (cnt) ? (ans) : (cnt));
  }
  printf("%d\n", ans);
  return;
}
int main() {
  c['R'] = 6;
  c['G'] = 7;
  c['B'] = 8;
  c['Y'] = 9;
  c['W'] = 10;
  read();
  solve();
  return 0;
}
