#include <bits/stdc++.h>
using namespace std;
bool vis[6][6];
map<char, int> m;
int C1[6], C2[6], aux1[6], aux2[6];
int main() {
  string s = "RGBYW";
  for (int i = 1; i <= 5; i++) m[s[i - 1]] = i;
  int n;
  while (cin >> n) {
    vector<int> V, B;
    string tipe;
    int id1, id2;
    for (int i = 0; i < n; i++) {
      cin >> tipe;
      id1 = m[tipe[0]];
      id2 = tipe[1] - '0';
      V.push_back(id1 * 6 + id2);
      vis[id1][id2] = true;
    }
    sort(V.begin(), V.end());
    B.push_back(V[0]);
    for (int i = 1; i < V.size(); i++)
      if (V[i] != V[i - 1]) B.push_back(V[i]);
    for (int i = 0; i < B.size(); i++) C1[B[i] / 6]++, C2[B[i] % 6]++;
    int ct = 0;
    for (int i = 1; i <= 5; i++)
      for (int j = 1; j <= 5; j++)
        if (vis[i][j]) ct++;
    int mini = 10;
    for (int i = 0; i < (1 << 10); i++) {
      int cant = 0;
      for (int j = 1; j <= 5; j++) aux1[j] = C1[j];
      for (int j = 1; j <= 5; j++) aux2[j] = C2[j];
      for (int j = 1; j <= 5; j++) {
        for (int k = 1; k <= 5; k++) {
          bool ok1 = ((i >> (j - 1)) & 1);
          bool ok2 = ((i >> (k - 1 + 5)) & 1);
          if (ok1 & ok2) {
            if (vis[j][k]) cant++, aux1[j]--, aux2[k]--;
          }
        }
      }
      while (true) {
        bool flag = false;
        for (int j = 1; j <= 5; j++) {
          for (int k = 1; k <= 5; k++) {
            bool ok1 = ((i >> (j - 1)) & 1);
            bool ok2 = ((i >> (k - 1 + 5)) & 1);
            if (vis[j][k] && !(ok1 && ok2)) {
              if ((ok1 && aux1[j] == 1)) {
                aux1[j]--, aux2[k]--, cant++, flag = true;
              }
              if ((ok2 && aux2[k] == 1)) {
                aux2[k]--, aux1[j]--, cant++, flag = true;
              }
            }
          }
        }
        if (!flag) break;
      }
      if (cant >= ct - 1) mini = min(mini, __builtin_popcount(i));
    }
    printf("%d\n", mini);
  }
}
