#include <bits/stdc++.h>
using namespace std;
int c[105], v[105], n;
bool qdc[105], qdv[105], flag[105];
int gs[6][6];
int gsc[6], gsv[6], rest;
int main() {
  scanf("%d", &n);
  char s[5];
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    if (s[0] == 'R')
      c[i] = 1;
    else if (s[0] == 'G')
      c[i] = 2;
    else if (s[0] == 'B')
      c[i] = 3;
    else if (s[0] == 'Y')
      c[i] = 4;
    else
      c[i] = 5;
    v[i] = s[1] - '0';
  }
  int ans = 1000;
  for (int zt = 0; zt < 1024; zt++) {
    memset(qdc, 0, sizeof(qdc));
    memset(qdv, 0, sizeof(qdv));
    memset(gsc, 0, sizeof(gsc));
    memset(gsv, 0, sizeof(gsv));
    memset(gs, 0, sizeof(gs));
    memset(flag, 0, sizeof(flag));
    for (int i = 1; i <= n; i++) ++gsc[c[i]], ++gsv[v[i]], ++gs[c[i]][v[i]];
    rest = n;
    int cnt = 0;
    for (int i = 1; i <= 5; i++) {
      if (!((zt >> (i - 1)) & 1)) continue;
      cnt++;
      for (int t = 1; t <= n; t++)
        if (c[t] == i) qdc[t] = true;
    }
    for (int i = 1; i <= 5; i++) {
      if (!((zt >> (i + 5 - 1)) & 1)) continue;
      cnt++;
      for (int t = 1; t <= n; t++)
        if (v[t] == i) qdv[t] = true;
    }
    for (int i = 1; i <= n; i++) {
      if (qdc[i] && qdv[i]) {
        flag[i] = true;
        rest--;
        --gsc[c[i]];
        --gsv[v[i]];
        --gs[c[i]][v[i]];
      }
    }
    while (true) {
      bool bb = false;
      for (int i = 1; i <= n; i++) {
        if (flag[i]) continue;
        if ((gs[c[i]][v[i]] == rest) ||
            (qdc[i] && gsc[c[i]] == gs[c[i]][v[i]]) ||
            (qdv[i] && gsv[v[i]] == gs[c[i]][v[i]])) {
          flag[i] = true;
          --rest;
          --gsc[c[i]];
          --gsv[v[i]];
          --gs[c[i]][v[i]];
          bb = true;
        }
      }
      if (!bb) break;
    }
    if (rest == 0) ans = min(ans, cnt);
  }
  printf("%d", ans);
  return 0;
}
