#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
const int MAXN = 100005;
const int G = 1;
const int R = 2;
const int B = 3;
const int Y = 4;
const int W = 0;
set<pair<int, int> > cards;
int solve(int mask) {
  for (set<pair<int, int> >::iterator i = cards.begin(); i != cards.end();
       i++) {
    for (set<pair<int, int> >::iterator j = cards.begin(); j != cards.end();
         j++) {
      if (j != i) {
        if (i->first != j->first) {
          if ((mask & (1 << (i->first + 5))) || (mask & (1 << (j->first + 5))))
            continue;
        }
        if (i->second != j->second)
          if ((mask & (1 << (i->second - 1))) ||
              (mask & (1 << (j->second - 1))))
            continue;
        return INF;
      }
    }
  }
  return __builtin_popcount(mask);
}
int main() {
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    char c;
    int n;
    cin >> c >> n;
    int color;
    switch (c) {
      case 'G':
        color = G;
        break;
      case 'B':
        color = B;
        break;
      case 'Y':
        color = Y;
        break;
      case 'W':
        color = W;
        break;
      case 'R':
        color = R;
        break;
    }
    cards.insert(make_pair(color, n));
  }
  int mn = INF;
  for (int i = 0; i < 1 << 10; i++) mn = min(mn, solve(i));
  cout << mn << endl;
  return 0;
}
