#include <bits/stdc++.h>
using namespace std;
vector<int> cards;
vector<bool> start;
int n, startleft;
bool possiblehint(int i, int hint) {
  if (hint < 5 && hint == i % 5) return true;
  return (hint - 5 == i / 5);
}
struct situation {
  vector<vector<bool> > possible;
  int left;
  situation() {
    possible = vector<vector<bool> >(n, start);
    left = startleft;
  }
  situation apply(int hint) {
    situation s2;
    s2.possible = possible;
    s2.left = left;
    for (int i = 0; i < n; i++) {
      bool ph1 = possiblehint(cards[i], hint);
      for (int j = 0; j < 25; j++) {
        if (!possible[i][j]) continue;
        bool ph = (possiblehint(j, hint) == ph1);
        if (!ph) s2.left--;
        s2.possible[i][j] = ph;
      }
    }
    return s2;
  }
};
int r(situation s, int depth) {
  if (s.left == n) {
    return 0;
  }
  if (depth >= 10) return 100;
  int r1 = 1 + r(s.apply(depth), depth + 1);
  int r2 = r(s, depth + 1);
  if (r1 < r2) return r1;
  return r2;
}
int main() {
  cin >> n;
  start = vector<bool>(25, false);
  startleft = 0;
  for (int i = 0; i < n; i++) {
    int id = 0, add;
    char c;
    cin >> c;
    switch (c) {
      case 'G':
        id = 5;
        break;
      case 'B':
        id = 10;
        break;
      case 'Y':
        id = 15;
        break;
      case 'W':
        id = 20;
        break;
    }
    cin >> add;
    id += add - 1;
    cards.push_back(id);
    if (!start[id]) startleft += n;
    start[id] = true;
  }
  cout << r(situation(), 0);
  return 0;
}
