#include <bits/stdc++.h>
using namespace std;
const int N = 1000;
int n, a[N], b[N], la[5], lb[5];
bool va[5], vb[5], v[N], vla[5], vlb[5];
bool chk() {
  int num = 0;
  for (int i = 0; i < n; i++) num += v[i] = va[a[i]] && vb[b[i]];
  while (true) {
    for (int i = 0; i < 5; i++) la[i] = lb[i] = -1, vla[i] = vlb[i] = true;
    for (int i = 0; i < n; i++) {
      if (v[i]) continue;
      if (la[a[i]] != -1 && b[la[a[i]]] != b[i]) vla[a[i]] = false;
      if (lb[b[i]] != -1 && a[lb[b[i]]] != a[i]) vlb[b[i]] = false;
      la[a[i]] = lb[b[i]] = i;
    }
    for (int i = 0; i < 5; i++)
      if (!va[i]) {
        bool flag = true;
        for (int j = 0; j < 5; j++)
          if (j != i && la[j] != -1) {
            flag = false;
            break;
          }
        if (flag) va[i] = true;
      }
    for (int i = 0; i < 5; i++)
      if (!vb[i]) {
        bool flag = true;
        for (int j = 0; j < 5; j++)
          if (j != i && lb[j] != -1) {
            flag = false;
            break;
          }
        if (flag) vb[i] = true;
      }
    bool flag = false;
    for (int i = 0; i < 5; i++)
      if (vla[i] && va[i])
        for (int j = 0; j < n; j++)
          if (!v[j] && a[j] == i) flag = true, v[j] = true, num++;
    for (int i = 0; i < 5; i++)
      if (vlb[i] && vb[i])
        for (int j = 0; j < n; j++)
          if (!v[j] && b[j] == i) flag = true, v[j] = true, num++;
    if (!flag) break;
  }
  return num == n;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    getchar();
    char ch = getchar();
    if (ch == 'B') a[i] = 0;
    if (ch == 'Y') a[i] = 1;
    if (ch == 'W') a[i] = 2;
    if (ch == 'G') a[i] = 3;
    if (ch == 'R') a[i] = 4;
    cin >> b[i];
    b[i]--;
  }
  int ans = 8;
  for (int aa = 0; aa < (1 << 10); aa++) {
    int tmp = aa, cnt = 0;
    for (int i = 0; i < 5; i++) va[i] = tmp & 1, tmp >>= 1, cnt += va[i];
    for (int i = 0; i < 5; i++) vb[i] = tmp & 1, tmp >>= 1, cnt += vb[i];
    if (cnt >= ans) continue;
    if (chk()) ans = cnt;
  }
  cout << ans << endl;
}
