#include <bits/stdc++.h>
using namespace std;
map<char, int> a;
set<int> m;
vector<int> ad;
char c[2];
int cnt(int mask) {
  int cn = 0;
  while (mask) {
    if (mask & 1) ++cn;
    mask >>= 1;
  }
  return cn;
}
int main(void) {
  a['1'] = 0, a['2'] = 1, a['3'] = 2, a['4'] = 3, a['5'] = 4, a['R'] = 5,
  a['B'] = 6, a['Y'] = 7, a['G'] = 8, a['W'] = 9;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", c);
    int b = 0 | (1 << a[c[0]]) | (1 << a[c[1]]);
    if (!m.count(b)) m.insert(b), ad.push_back(b);
  }
  int ans = 1e9;
  for (int mask = 0; mask <= 1024; ++mask) {
    int res = 0;
    map<int, int> A;
    for (size_t i = 0; i < ad.size(); i++) {
      A[mask & ad[i]]++;
      ++res;
      if (A[mask & ad[i]] > 1) res = ad.size() + 1;
    }
    if (res + 1 == ad.size() || res == ad.size()) ans = min(ans, cnt(mask));
  }
  printf("%d\n", ans);
  return 0;
}
