#include <bits/stdc++.h>
using namespace std;
long long gcd(long long n1, long long n2) {
  if (n2 == 0) return n1;
  if (n1 % n2 == 0) return n2;
  return gcd(n2, n1 % n2);
}
long long powmod(long long base, long long exponent) {
  if (exponent < 0) exponent += 1000000007LL - 1;
  long long ans = 1;
  while (exponent) {
    if (exponent & 1) ans = (ans * base) % 1000000007LL;
    base = (base * base) % 1000000007LL;
    exponent /= 2;
  }
  return ans;
}
pair<int, int> mark[105];
map<char, int> m;
pair<int, int> val[105];
int main() {
  int n, ans = 10;
  cin >> n;
  m['R'] = 0;
  m['G'] = 1;
  m['B'] = 2;
  m['Y'] = 3;
  m['W'] = 4;
  for (int i = 0; i < n; i++) {
    char c;
    int n;
    cin >> c >> n;
    val[i] = make_pair(m[c], n + 4);
  }
  for (int i = 0; i < (1 << 10); i++) {
    bool flag = 1;
    int cnt = 0;
    for (int j = 0; j < 10; j++) {
      if ((1 << j) & i) cnt++;
    }
    for (int j = 0; j < n; j++) {
      mark[j] = make_pair(0, 0);
      if ((1 << val[j].first) & i) mark[j].first = 1;
      if ((1 << val[j].second) & i) mark[j].second = 1;
    }
    for (int j = 0; j < n; j++) {
      for (int k = j + 1; k < n; k++) {
        int cnt = 0;
        if (val[j] == val[k]) continue;
        if (val[j].first != val[k].first && mark[j].first + mark[k].first > 0)
          cnt++;
        if (val[j].second != val[k].second &&
            mark[j].second + mark[k].second > 0)
          cnt++;
        if (cnt == 0) flag = false;
      }
    }
    if (flag) ans = min(ans, cnt);
  }
  cout << ans << '\n';
}
