#include <bits/stdc++.h>
using namespace std;
const char c2[5] = {'R', 'G', 'B', 'Y', 'W'};
bool is[5][5];
int r[5], c[5];
int tekr[5], tekc[5];
bool use[5][5];
int main() {
  int n;
  cin >> n;
  memset(is, 0, sizeof(is));
  string st;
  for (int i = 0; i < int(n); i++) {
    cin >> st;
    char c1 = st[0];
    int j1 = st[1] - '1', i1 = -1;
    for (int j = 0; j < int(5); j++) {
      if (c2[j] == c1) {
        i1 = j;
        break;
      }
    }
    assert(i1 >= 0);
    is[i1][j1] = true;
  }
  int res = 0;
  for (int i = 0; i < int(5); i++)
    for (int j = 0; j < int(5); j++) {
      res += is[i][j];
      r[i] += is[i][j];
      c[j] += is[i][j];
    }
  int ans = 10;
  for (int maski = 0; maski < int((1 << 5)); maski++) {
    for (int maskj = 0; maskj < int((1 << 5)); maskj++) {
      int cnt = 0;
      memset(tekr, 0, sizeof(tekr));
      memset(tekc, 0, sizeof(tekc));
      memset(use, false, sizeof(use));
      for (int k = 0; k < int(25); k++) {
        for (int i = 0; i < int(5); i++) {
          for (int j = 0; j < int(5); j++) {
            if (use[i][j] || !is[i][j]) continue;
            if (((maski & (1 << i)) != 0) && ((maskj & (1 << j)) != 0)) {
              use[i][j] = true;
              tekr[i]++;
              tekc[j]++;
              cnt++;
              continue;
            }
            if (((maski & (1 << i)) != 0)) {
              if (tekr[i] == r[i] - 1) {
                use[i][j] = true;
                tekr[i]++;
                tekc[j]++;
                cnt++;
                continue;
              }
            }
            if (((maskj & (1 << j)) != 0)) {
              if (tekc[j] == c[j] - 1) {
                use[i][j] = true;
                tekr[i]++;
                tekc[j]++;
                cnt++;
                continue;
              }
            }
            if (cnt == res - 1) {
              use[i][j] = true;
              tekr[i]++;
              tekc[j]++;
              cnt++;
              continue;
            }
          }
        }
      }
      if (cnt == res) {
        int ans1 = 0;
        for (int k = 0; k < int(5); k++) {
          ans1 += ((maski & (1 << k)) > 0);
          ans1 += ((maskj & (1 << k)) > 0);
        }
        ans = min(ans, ans1);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
