#include <bits/stdc++.h>
using namespace std;
int cnt[5][5], row[5], col[5];
const char clr[6] = "RGBYW";
int main() {
  int n;
  scanf("%d%*c", &n);
  for (int i = 1; i <= n; ++i) {
    char s[3];
    scanf("%s", s);
    int pos = 0;
    while (clr[pos] != s[0]) ++pos;
    ++cnt[pos][s[1] - '1'];
    ++row[pos];
    ++col[s[1] - '1'];
  }
  int ans = 1000000000;
  for (int msk = 0; msk < (1 << 10); ++msk) {
    bool selr[5], selc[5], vst[5][5];
    for (int i = 0; i < 5; ++i) selr[i] = (msk >> i) & 1;
    for (int i = 5; i < 10; ++i) selc[i - 5] = (msk >> i) & 1;
    memset(vst, 0, sizeof(vst));
    for (int i = 0; i < 5; ++i)
      for (int j = 0; j < 5; ++j)
        if (cnt[i][j]) {
          if (selr[i] && row[i] == 1) vst[i][j] = true;
          if (selc[j] && col[j] == 1) vst[i][j] = true;
          if (selr[i] && selc[j]) vst[i][j] = true;
        }
    for (int times = 0; times < 25; ++times) {
      for (int i = 0; i < 5; ++i)
        if (selr[i]) {
          int emp = 0, lst;
          for (int j = 0; j < 5; ++j)
            if (cnt[i][j] && !vst[i][j]) {
              ++emp;
              lst = j;
            }
          if (emp == 1) vst[i][lst] = true;
        }
      for (int j = 0; j < 5; ++j)
        if (selc[j]) {
          int emp = 0, lst;
          for (int i = 0; i < 5; ++i)
            if (cnt[i][j] && !vst[i][j]) {
              ++emp;
              lst = i;
            }
          if (emp == 1) vst[lst][j] = true;
        }
    }
    int emp = 0;
    for (int i = 0; i < 5; ++i)
      for (int j = 0; j < 5; ++j)
        if (cnt[i][j] && !vst[i][j]) ++emp;
    if (emp <= 1) ans = min(ans, __builtin_popcount(msk));
  }
  printf("%d", ans);
}
