#include <bits/stdc++.h>
int here[5][5];
int num[2048];
bool flag;
int ans;
int cost;
int n;
int countdigit(int x) {
  int exv = 0;
  while (x) {
    if (x & 1) ++exv;
    x /= 2;
  }
  return exv;
}
int color(char ch) {
  if (ch == 'R') return 0;
  if (ch == 'G') return 1;
  if (ch == 'B') return 2;
  if (ch == 'Y') return 3;
  return 4;
}
char getcolor() {
  char ch = ' ';
  while (ch != 'R' && ch != 'G' && ch != 'B' && ch != 'Y' && ch != 'W')
    ch = getchar();
  return ch;
}
int main() {
  int tmp;
  ans = 11;
  scanf("%d", &n);
  int a, b;
  for (int i = 1; i <= n; ++i) {
    a = color(getcolor());
    scanf("%d", &b);
    --b;
    here[a][b] = true;
  }
  for (int i = 0; i < 1024; ++i) {
    flag = true;
    for (int j = 0; j < 5; ++j)
      for (int k = 0; k < 5; ++k) {
        tmp = 0;
        if (i & (1 << j)) tmp |= (1 << j);
        if (i & (1 << (k + 5))) tmp |= (1 << (k + 5));
        if (here[j][k]) {
          if (num[tmp] == i + 1) flag = false;
          num[tmp] = i + 1;
        }
      }
    cost = countdigit(i);
    if (flag && cost < ans) {
      ans = cost;
    }
  }
  printf("%d\n", ans);
  return 0;
}
