#include <bits/stdc++.h>
using namespace std;
int n, ans;
int g[6][6];
int xx[6], yy[6];
bool check() {
  for (int i = 1; i <= 5; i++) {
    for (int j = 1; j <= 5; j++) {
      for (int k = 1; k <= 5; k++) {
        for (int l = 1; l <= 5; l++) {
          if (g[i][j] + g[k][l] != 2)
            continue;
          else if (i == k && j == l)
            continue;
          else if (i == k) {
            if (yy[j] + yy[l] == 0) return 0;
          } else if (j == l) {
            if (xx[i] + xx[k] == 0) return 0;
          } else {
            if (xx[i] + xx[k] + yy[j] + yy[l] == 0) return 0;
          }
        }
      }
    }
  }
  return 1;
}
int main() {
  int n;
  char s[20];
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    int color, num;
    if (s[0] == 'R')
      color = 1;
    else if (s[0] == 'G')
      color = 2;
    else if (s[0] == 'B')
      color = 3;
    else if (s[0] == 'Y')
      color = 4;
    else if (s[0] == 'W')
      color = 5;
    num = s[1] - '0';
    g[color][num] = 1;
  }
  int ans = 10;
  for (int i = 0; i < 1024; i++) {
    int p = 10;
    int temp = i;
    int tot = 0;
    memset(xx, 0, sizeof(xx));
    memset(yy, 0, sizeof(yy));
    while (temp) {
      int r = temp & 1;
      if (r) tot++;
      if (p > 5)
        yy[p - 5] = r;
      else
        xx[p] = r;
      p--;
      temp >>= 1;
    }
    if (check()) ans = min(ans, tot);
  }
  printf("%d\n", ans);
  return 0;
}
