#include <bits/stdc++.h>
using namespace std;
const int size = 407;
const long long modulo = 1000000007;
const long long oo = 7e18;
const double EPS = 1e-13;
const double PI = acos(-1.0);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> a(n);
  map<char, int> rang;
  rang['R'] = 0;
  rang['G'] = 1;
  rang['B'] = 2;
  rang['Y'] = 3;
  rang['W'] = 4;
  vector<int> k_rang(5, 0), k_color(5, 0);
  vector<int> total(25, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    int r = rang[a[i][0]], c = a[i][1] - '1';
    k_rang[rang[a[i][0]]]++;
    k_color[a[i][1] - '1']++;
    total[5 * r + c]++;
  }
  int ans = 10;
  for (int mask = 0; mask < 1024; mask++) {
    bool ok = true;
    int cur = 0;
    vector<bool> b_rang(5, false), b_color(5, false);
    vector<int> kr(k_rang), kc(k_color);
    vector<int> kt(total);
    for (int i = 0; i < 5; i++)
      if ((mask >> i) & 1) b_rang[i] = true, ++cur;
    for (int i = 5; i < 10; i++)
      if ((mask >> i) & 1) b_color[i - 5] = true, ++cur;
    vector<bool> solved(n, false);
    for (int i = 0; i < n; i++)
      if (b_rang[rang[a[i][0]]] && b_color[a[i][1] - '1']) {
        solved[i] = true;
        int r = rang[a[i][0]], c = a[i][1] - '1';
        kr[rang[a[i][0]]]--;
        kc[a[i][1] - '1']--;
        kt[5 * r + c]--;
      }
    string sample = "?";
    for (int i = 0; i < n && ok; i++)
      if (!solved[i] && !b_rang[rang[a[i][0]]] && !b_color[a[i][1] - '1']) {
        if (sample == "?" || sample == a[i]) {
          sample = a[i];
          solved[i] = true;
          int r = rang[a[i][0]], c = a[i][1] - '1';
          kr[rang[a[i][0]]]--;
          kc[a[i][1] - '1']--;
          kt[5 * r + c]--;
        } else
          ok = false;
      }
    for (int i = 0; i < n && ok; i++)
      if (!solved[i] && (b_rang[rang[a[i][0]]] || b_color[a[i][1] - '1'])) {
        if (b_rang[rang[a[i][0]]]) {
          int cand = -1;
          for (int j = 0; j < 5; j++)
            if (kt[rang[a[i][0]] * 5 + j] > 0) {
              if (cand < 0)
                cand = j;
              else
                ok = false;
            }
          if (!ok) break;
          solved[i] = true;
          int r = rang[a[i][0]], c = a[i][1] - '1';
          kr[rang[a[i][0]]]--;
          kc[a[i][1] - '1']--;
          kt[5 * r + c]--;
        } else {
          int cand = -1;
          for (int j = 0; j < 5; j++)
            if (kt[j * 5 + a[i][1] - '1'] > 0) {
              if (cand < 0)
                cand = j;
              else
                ok = false;
            }
          if (!ok) break;
          solved[i] = true;
          int r = rang[a[i][0]], c = a[i][1] - '1';
          kr[rang[a[i][0]]]--;
          kc[a[i][1] - '1']--;
          kt[5 * r + c]--;
        }
      }
    if (ok) ans = min(ans, cur);
  }
  cout << ans << endl;
  return 0;
}
