#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int mapp[256];
  mapp['R'] = 0;
  mapp['G'] = 1;
  mapp['B'] = 2;
  mapp['Y'] = 3;
  mapp['W'] = 4;
  mapp['1'] = 0;
  mapp['2'] = 1;
  mapp['3'] = 2;
  mapp['4'] = 3;
  mapp['5'] = 4;
  string card[101];
  int grac[5][5] = {0};
  int grav[5][5] = {0};
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> card[i];
    grac[mapp[card[i][0]]][mapp[card[i][1]]] = 1;
    grav[mapp[card[i][1]]][mapp[card[i][0]]] = 1;
  }
  int mH = 100;
  for (int i = 0; i < 1024; i++) {
    int markc[5][5] = {0};
    int markv[5][5] = {0};
    int h = 0;
    for (int j = 0; j < 5; j++) {
      if ((i & (1 << j))) {
        int ad = 0;
        for (int k = 0; k < 5; k++)
          if (grav[k][j]) ad = 1, markv[k][j] = 1;
        h += ad;
      }
    }
    for (int j = 5; j < 10; j++) {
      if ((i & (1 << j))) {
        int ad = 0, dd = 0;
        for (int k = 0; k < 5; k++)
          if (grac[k][j - 5]) ad = 1, markc[k][j - 5] = 1;
        h += ad;
      }
    }
    int cs = 1;
    for (int j = 0; j < 5; j++) {
      int cntg = 0, cntm = 0;
      for (int k = 0; k < 5; k++) {
        if (grac[j][k]) cntg++;
        if (markc[j][k]) cntm++;
      }
      if (cntm < cntg - 1) {
        cs = 0;
        break;
      }
    }
    if (!cs) continue;
    int vs = 1;
    for (int j = 0; j < 5; j++) {
      int cntg = 0, cntm = 0;
      for (int k = 0; k < 5; k++) {
        if (grav[j][k]) cntg++;
        if (markv[j][k]) cntm++;
      }
      if (cntm < cntg - 1) {
        vs = 0;
        break;
      }
    }
    if (!vs) continue;
    int mark[101] = {0};
    for (int j = 0; j < 5; j++) {
      if ((i & (1 << j)))
        for (int k = 0; k < n; k++)
          if (j == mapp[card[k][0]]) mark[k] = 1;
    }
    for (int j = 5; j < 10; j++) {
      if ((i & (1 << j)))
        for (int k = 0; k < n; k++)
          if ((j - 5) == mapp[card[k][1]]) mark[k] = 1;
    }
    string cr = "";
    int unique = 1;
    for (int j = 0; j < n; j++) {
      if (!mark[j]) {
        if (cr != "" && cr != card[j]) {
          unique = 0;
          break;
        }
        cr = card[j];
      }
    }
    if (unique && h < mH) {
      mH = h;
    }
  }
  cout << mH << endl;
  return 0;
}
