#include <bits/stdc++.h>
using namespace std;
int g[10][10], w[26], use[10], ans = 10;
int f[10][10], num;
void work(int tot) {
  memset(f, 0, sizeof(f));
  for (int i = 1; i <= 5; i++)
    for (int j = 1; j <= 5; j++)
      if (g[i][j] && use[i]) f[i][j]++;
  for (int i = 6; i <= 10; i++)
    for (int j = 1; j <= 5; j++)
      if (g[j][i - 5] && use[i]) f[j][i - 5]++;
  int cnt = num;
  for (int i = 1; i <= 5; i++)
    for (int j = 1; j <= 5; j++)
      if (g[i][j]) {
        if (f[i][j] == 2)
          cnt--;
        else if (f[i][j] == 1) {
          int flag = 0;
          if (use[i]) {
            for (int t = 1; t <= 5; t++)
              if (f[i][t] == 1 && t != j) {
                flag = 1;
                break;
              }
            if (!flag) cnt--;
            flag = 0;
          } else {
            for (int t = 1; t <= 5; t++)
              if (f[t][j] == 1 && t != i) {
                flag = 1;
                break;
              }
            if (!flag) cnt--;
            flag = 0;
          }
        }
      }
  if (cnt <= 1) ans = min(ans, tot);
}
void dfs(int x, int tot) {
  if (x > 10) {
    work(tot);
    return;
  }
  use[x] = 1;
  dfs(x + 1, tot + 1);
  use[x] = 0;
  dfs(x + 1, tot);
}
int main() {
  int n, x;
  char c, d;
  w['R' - 'A'] = 1;
  w['G' - 'A'] = 2;
  w['B' - 'A'] = 3;
  w['Y' - 'A'] = 4;
  w['W' - 'A'] = 5;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%c%c%d", &d, &c, &x);
    g[w[c - 'A']][x] = 1;
  }
  for (int i = 1; i <= 5; i++)
    for (int j = 1; j <= 5; j++) num += g[i][j];
  dfs(1, 0);
  printf("%d\n", ans);
  return 0;
}
