#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
const int inf = 0x3f3f3f3f;
char carta[10];
int id(char c) {
  if (c == 'R') return 0;
  if (c == 'G') return 1;
  if (c == 'B') return 2;
  if (c == 'Y') return 3;
  return 4;
}
vector<pair<int, int> > vec;
int main() {
  int n;
  scanf("%d", &n);
  int qc = 0, qv = 0;
  for (int i = (0); i < (n); ++i) {
    scanf("%s", carta);
    int c = id(carta[0]);
    int v = carta[1] - '1';
    vec.push_back(pair<int, int>(c, v));
  }
  sort(vec.begin(), vec.end());
  vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
  n = vec.size();
  int ans = inf;
  for (int cor = (0); cor < (32); ++cor)
    for (int val = (0); val < (32); ++val) {
      for (int i = (0); i < (n); ++i)
        for (int j = (i + 1); j < (n); ++j) {
          int lol = 0;
          if (vec[i].first != vec[j].first &&
              (((1 << vec[i].first) & cor) || ((1 << vec[j].first) & cor)))
            ++lol;
          if (vec[i].second != vec[j].second &&
              (((1 << vec[i].second) & val) || ((1 << vec[j].second) & val)))
            ++lol;
          if (!lol) goto fim;
        }
      ans = min(ans, __builtin_popcount(cor) + __builtin_popcount(val));
    fim:;
    }
  printf("%d\n", ans);
  return 0;
}
