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