#include <bits/stdc++.h>
using namespace std;
int i, j;
string a[110];
int f[110];
int g[110];
int h1[110];
int h2[110];
int s1[110];
int s2[110];
int rem;
void del(int k) {
  rem--;
  s1[f[k]] -= k;
  s2[g[k]] -= k;
  h1[f[k]]--;
  h2[g[k]]--;
  if (h1[f[k]] == 1 && (1 << f[k] & i)) del(s1[f[k]]);
  if (h2[g[k]] == 1 && (1 << g[k] & j)) del(s2[g[k]]);
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  n = unique(a, a + n) - a;
  for (int i = 0; i < n; i++) {
    f[i] = (a[i][0] > 'R') + (a[i][0] > 'G') + (a[i][0] > 'B') +
           (a[i][0] > 'Y') + (a[i][0] > 'W');
    g[i] = a[i][1] - '1';
  }
  int ans = 11;
  for (i = 0; i < 32; i++) {
    for (j = 0; j < 32; j++) {
      memset(h1, 0, sizeof(h1));
      memset(h2, 0, sizeof(h2));
      memset(s1, 0, sizeof(s1));
      memset(s2, 0, sizeof(s2));
      rem = n;
      for (int k = 0; k < n; k++) {
        if ((1 << f[k] & i) && (1 << g[k] & j))
          rem--;
        else {
          s1[f[k]] += k;
          s2[g[k]] += k;
          h1[f[k]]++;
          h2[g[k]]++;
        }
      }
      for (int x = 0; x < 5; x++) {
        if ((1 << x & i) && (h1[x] == 1)) del(s1[x]);
        if ((1 << x & j) && (h2[x] == 1)) del(s2[x]);
      }
      if (rem <= 1) {
        int c = 0;
        for (int x = 0; x < 5; x++)
          c += (bool)(1 << x & i) + (bool)(1 << x & j);
        ans = min(ans, c);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
