#include <bits/stdc++.h>
using namespace std;
int calc(int x) {
  int res = 0;
  for (; x; x >>= 1) res += x % 2;
  return res;
}
int main() {
  int cnt[100] = {}, ct[100] = {}, ct2[100] = {}, mark[100] = {};
  char c[6] = "BYWGR";
  map<char, int> mp;
  for (int i = 0; i < 5; i++) mp[c[i]] = i;
  int n;
  char s[100];
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    int x = mp[s[0]], y = s[1] - 49;
    cnt[x * 10 + y] = 1;
  }
  int ans = 111;
  for (int i = 0; i < 31; i++)
    for (int j = 0; j < 31; j++) {
      int flag = 1;
      for (int x = 0; x < 5; x++)
        for (int y = 0; y < 5; y++)
          if (cnt[10 * x + y]) {
            if ((i & (1 << x)) && (j & (1 << y)))
              mark[10 * x + y] = 0;
            else
              mark[10 * x + y] = 1;
          } else
            mark[10 * x + y] = 0;
      for (;;) {
        int tot = 0;
        memset(ct, 0, sizeof(ct));
        memset(ct2, 0, sizeof(ct2));
        for (int x = 0; x < 5; x++)
          for (int y = 0; y < 5; y++)
            ct[x] += mark[10 * x + y], ct2[y] += mark[10 * x + y];
        for (int x = 0; x < 5; x++)
          for (int y = 0; y < 5; y++)
            if (mark[10 * x + y])
              if ((ct[x] <= 1 && (i & (1 << x))) ||
                  (ct2[y] <= 1 && (j & (1 << y))))
                mark[10 * x + y] = 0, tot++;
        if (tot == 0) break;
      }
      int tot = 0;
      for (int x = 0; x < 5; x++)
        for (int y = 0; y < 5; y++)
          if (mark[10 * x + y]) tot++;
      if (tot < 2) ans = min(ans, calc(i) + calc(j));
    }
  cout << ans << endl;
  return 0;
}
