#include <bits/stdc++.h>
using namespace std;
int n;
vector<bitset<10>> cards;
bool query(int hint) {
  bitset<10> hintBit(hint);
  vector<int> noHint, oneHint[10];
  for (int i = 0; i < n; i++) {
    bitset<10> matched = hintBit & cards[i];
    if (matched.count() == 1) {
      for (int j = 0; j < 10; j++)
        if (matched.test(j)) oneHint[j].push_back(i);
    } else if (matched.count() == 0)
      noHint.push_back(i);
  }
  for (int i = 0; i < 10; i++)
    for (int j = 1; j < oneHint[i].size(); j++)
      if (cards[oneHint[i][0]] != cards[oneHint[i][j]]) return false;
  for (int i = 1; i < noHint.size(); i++)
    if (cards[noHint[0]] != cards[noHint[i]]) return false;
  return true;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    string str;
    cin >> str;
    bitset<10> now(0);
    switch (str[0]) {
      case 'R':
        now[0] = true;
        break;
      case 'G':
        now[1] = true;
        break;
      case 'B':
        now[2] = true;
        break;
      case 'Y':
        now[3] = true;
        break;
      case 'W':
        now[4] = true;
        break;
    }
    now[str[1] - '0' + 4] = true;
    cards.push_back(now);
  }
  size_t ans = 999;
  for (int i = 0; i < (1 << 10); i++)
    if (query(i)) ans = min(ans, bitset<10>(i).count());
  cout << ans;
}
