#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-8;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const int maxn = 30;
set<int> st[10];
int all = 1 << 10, ans = INF;
int change(char x) {
  if (x == 'B')
    return 0;
  else if (x == 'Y')
    return 1;
  else if (x == 'W')
    return 2;
  else if (x == 'G')
    return 3;
  else
    return 4;
}
void fun(int num, set<int> st[]) {
  int one = 0, t[10] = {0};
  for (int j = 1, ct = 0; j < all; j <<= 1, ct++)
    if (num & j) {
      one++;
      t[ct] = 1;
    }
  for (int i = 0; i < (5); ++i)
    for (int j = (5); j < (10); ++j)
      if (t[i] && t[j]) {
        st[i].erase(j);
        st[j].erase(i);
      }
  for (int i = 0; i < (10); ++i)
    if (t[i] && st[i].size() == 1) {
      int v = *(st[i].begin());
      st[v].erase(i);
      st[i].clear();
    }
  int len = 0;
  for (int i = 0; i < (5); ++i) len += st[i].size();
  if (len <= 1) ans = min(ans, one);
}
int main() {
  int n;
  char x;
  int y;
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    cin >> x >> y;
    st[change(x)].insert(y + 4);
    st[y + 4].insert(change(x));
  }
  for (int i = (0); i < (all); ++i) {
    set<int> tt[10];
    for (int i = 0; i < (10); ++i) tt[i] = st[i];
    fun(i, tt);
  }
  printf("%d\n", ans);
  return 0;
}
