#include <bits/stdc++.h>
using namespace std;
const int maxN = 100 + 5;
const int mod = 1000 * 1000 * 1000;
map<char, int> mp;
int x[maxN];
char t[maxN];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  mp['R'] = 0;
  mp['G'] = 1;
  mp['B'] = 2;
  mp['Y'] = 3;
  mp['W'] = 4;
  for (int i = 0; i < n; i++) {
    cin >> t[i] >> x[i];
    x[i]--;
  }
  int ans = mod;
  for (int mask1 = 0; mask1 < (1 << 5); mask1++) {
    for (int mask2 = 0; mask2 < (1 << 5); mask2++) {
      int fl = 1;
      for (int i = 0; i < n; i++)
        for (int j = i + 1; j < n; j++) {
          if (x[i] == x[j] && t[i] == t[j]) continue;
          if (x[i] != x[j]) {
            if ((mask1 & (1 << x[i])) || (mask1 & (1 << x[j]))) continue;
          }
          if (mp[t[i]] != mp[t[j]]) {
            if ((mask2 & (1 << mp[t[i]])) || (mask2 & (1 << mp[t[j]])))
              continue;
          }
          fl = 0;
        }
      if (fl)
        ans = min(ans, __builtin_popcount(mask1) + __builtin_popcount(mask2));
    }
  }
  cout << ans << endl;
  return 0;
}
