#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const double eps = 1e-9;
void bset(int &b, int i) { b |= (1 << i); }
void bunset(int &b, int i) { b = (b & ~(1 << i)); }
int bget(int b, int i) { return b & (1 << i); }
int bcnt(int b) { return __builtin_popcount(b); }
map<char, int> color2id = {{'R', 0}, {'G', 1}, {'B', 2}, {'Y', 3}, {'W', 4}};
int pos(int col, int val) { return 5 * col + val; }
int best;
int cards;
int stepmask[10];
int group[12][25], gn[12];
const int maxN = 100;
int N;
void check(int step, int hints) {
  if (best <= hints) return;
  for (int g = int(gn[step]) - 1; g >= (0); g--) {
    if (bcnt(group[step][g]) > 1) continue;
    group[step][g] = group[step][--gn[step]];
  }
  if (gn[step] == 0) {
    best = min(best, hints);
    return;
  }
  if (step >= 10) return;
  gn[step + 1] = gn[step];
  for (int g = (0); g < (gn[step]); g++) {
    group[step + 1][g] = group[step][g];
  }
  check(step + 1, hints);
  gn[step + 1] = gn[step];
  for (int g = (0); g < (gn[step]); g++) {
    int a = group[step][g] & stepmask[step];
    int b = group[step][g] & ~stepmask[step];
    if (!a || !b) {
      group[step + 1][g] = group[step][g];
    } else {
      group[step + 1][g] = a;
      group[step + 1][gn[step + 1]++] = b;
    }
  }
  check(step + 1, hints + 1);
}
int main() {
  ios::sync_with_stdio(false);
  for (int c = (0); c < (5); c++) {
    for (int v = (0); v < (5); v++) bset(stepmask[c], pos(c, v));
    for (int v = (0); v < (5); v++) bset(stepmask[v + 5], pos(c, v));
  }
  cin >> N;
  for (int i = (0); i < (N); i++) {
    char c;
    int v;
    cin >> c >> v;
    int a = color2id.at(c), b = v - 1;
    bset(cards, pos(a, b));
  }
  best = 8;
  gn[0] = 1;
  group[0][0] = cards;
  check(0, 0);
  cout << best << endl;
}
