#include <bits/stdc++.h>
using namespace std;
int n, ans;
int a[110];
int b[110];
int Get_ch() {
  char c = getchar();
  while (1) {
    if (c == 'R') return 1;
    if (c == 'G') return 2;
    if (c == 'B') return 3;
    if (c == 'Y') return 4;
    if (c == 'W') return 5;
    c = getchar();
  }
}
int Get_num() {
  char c = getchar();
  while ((c < '0') || (c > '9')) c = getchar();
  return c - '0';
}
int F(int p, int k) {
  if (p & (1 << (k - 1))) return 1;
  return 0;
}
int Check(int p, int q) {
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= i - 1; ++j)
      if ((a[i] != a[j]) || (b[i] != b[j])) {
        int tmp1 = F(p, a[i]) * 2 + F(q, b[i]);
        int tmp2 = F(p, a[j]) * 2 + F(q, b[j]);
        if (tmp1 == tmp2) {
          if (F(p, a[i]) && (a[i] != a[j])) continue;
          if (F(q, b[i]) && (b[i] != b[j])) continue;
          return false;
        }
      }
  return true;
}
int Chai(int k) {
  int ret = 0;
  while (k) {
    k -= (k & (-k));
    ++ret;
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    a[i] = Get_ch();
    b[i] = Get_num();
  }
  ans = 20;
  for (int i = 0; i <= 31; ++i)
    for (int j = 0; j <= 31; ++j)
      if (Check(i, j)) ans = min(ans, Chai(i) + Chai(j));
  printf("%d\n", ans);
  return 0;
}
