#include <bits/stdc++.h>
using namespace std;
int N, sol;
string CC[111];
string colors = "RGYWB";
int c[111], v[111];
bool con[10], von[10];
vector<string> V[10], C[10], both;
int main() {
  cin >> N;
  for (int I = 0; I < N; I++) {
    cin >> CC[I];
    c[I] = colors.find(CC[I][0]);
    v[I] = CC[I][1] - '1';
  }
  sol = 30;
  for (int col = 0; col < (1 << 5); col++)
    for (int val = 0; val < (1 << 5); val++) {
      for (int I = 0; I < 5; I++) {
        con[I] = col & (1 << I);
        von[I] = val & (1 << I);
        V[I].clear();
        C[I].clear();
      }
      both.clear();
      for (int I = 0; I < N; I++) {
        if (con[c[I]] && von[v[I]]) continue;
        if (con[c[I]])
          V[c[I]].push_back(CC[I]);
        else if (von[v[I]])
          C[v[I]].push_back(CC[I]);
        else
          both.push_back(CC[I]);
      }
      bool ok = true;
      for (int I = 0; I < 5; I++) {
        sort((V[I]).begin(), (V[I]).end());
        sort((C[I]).begin(), (C[I]).end());
        ok &= (unique((V[I]).begin(), (V[I]).end()) - V[I].begin() <= 1);
        ok &= (unique((C[I]).begin(), (C[I]).end()) - C[I].begin() <= 1);
      }
      sort((both).begin(), (both).end());
      ok &= (unique((both).begin(), (both).end()) - both.begin() <= 1);
      if (ok) sol = min(sol, __builtin_popcount(col) + __builtin_popcount(val));
    }
  cout << sol << endl;
}
