#include <bits/stdc++.h>
using namespace std;
const int INFI = 1 << 28;
const long long int INFL = 1LL << 60;
const double INFD = 1e+300;
const double EPS = 1e-8;
bool f(const vector<string> &cards, const vector<string> &hand) {
  int L = cards.size();
  vector<bool> h_used(L, false);
  vector<bool> c_used(L, false);
  int cnt = 0;
  while (true) {
    bool update = false;
    for (int i = 0; i < L; i++) {
      if (h_used[i]) continue;
      set<string> candidate;
      int idx = 0;
      for (int j = 0; j < L; j++) {
        if (c_used[j]) continue;
        if ((hand[i][0] == '*' || hand[i][0] == cards[j][0]) &&
            (hand[i][1] == '*' || hand[i][1] == cards[j][1])) {
          candidate.insert(cards[j]);
          if (candidate.size() >= 2) break;
          idx = j;
        }
      }
      if (candidate.size() == 1) {
        update = true;
        c_used[idx] = true;
        h_used[i] = true;
        cnt++;
        break;
      }
    }
    if (!update) break;
  }
  return cnt == L;
}
int main() {
  int L;
  cin >> L;
  vector<string> cards(L);
  for (int i = 0; i < L; i++) {
    cin >> cards[i];
  }
  const char *M = "RGBYW";
  const char *N = "12345";
  int ans = 1 << 28;
  for (int m = 0; m < (1 << 5); m++) {
    for (int n = 0; n < (1 << 5); n++) {
      vector<string> tmp(L, string("**"));
      for (int i = 0; i < L; i++) {
        for (int j = 0; j < 5; j++) {
          if ((m & (1 << j)) && M[j] == cards[i][0]) tmp[i][0] = M[j];
          if ((n & (1 << j)) && N[j] == cards[i][1]) tmp[i][1] = N[j];
        }
      }
      int mbit = __builtin_popcount(m);
      int nbit = __builtin_popcount(n);
      if (f(cards, tmp)) {
        ans = min(ans, mbit + nbit);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
