#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int n;
bool used[30][6];
int found[N], type[N];
bool subtracted[N];
int remain[10], org_remain[10];
vector<pair<char, char> > card;
map<char, int> mp;
string s;
vector<char> v;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (!used[s[0] - 'A'][s[1] - '0']) {
      used[s[0] - 'A'][s[1] - '0'] = 1;
      card.push_back({s[0], s[1]});
    }
  }
  v = {'R', 'G', 'B', 'Y', 'W'};
  for (int i = 1; i <= 5; i++) v.push_back('0' + i);
  for (int i = 0; i < 10; i++) {
    mp[v[i]] = i;
  }
  for (auto x : card) {
    for (int i = 0; i < v.size(); i++) {
      if (x.first == v[i]) remain[i]++;
      if (x.second == v[i]) remain[i]++;
    }
  }
  for (int i = 0; i < v.size(); i++) org_remain[i] = remain[i];
  if (card.size() == 1) return cout << 0, 0;
  int ans = 11;
  for (int mask = 0; mask < (1 << 10); mask++) {
    memset(found, 0, sizeof found);
    memset(subtracted, 0, sizeof subtracted);
    memset(type, 0, sizeof type);
    for (int i = 0; i < 10; i++) remain[i] = org_remain[i];
    vector<char> tmp;
    vector<char> dm = {'R', 'Y', 'W', '1', '3', '5'};
    for (int len = 0; len < 10; len++) {
      if ((mask >> len) & 1) tmp.push_back(v[len]);
    }
    for (int i = 0; i < tmp.size(); i++) {
      for (int j = 0; j < card.size(); j++) {
        if (subtracted[j]) continue;
        if (found[j] == 2 && !subtracted[j]) {
          subtracted[j] = 1;
          continue;
        }
        char c = card[j].first, num = card[j].second;
        if (c == tmp[i]) {
          found[j]++;
          type[j] = 1;
        } else if (num == tmp[i]) {
          found[j]++;
          type[j] = 2;
        }
      }
    }
    for (int j = 0; j < card.size(); j++) {
      if (found[j] == 2) {
        remain[mp[card[j].first]]--;
        remain[mp[card[j].second]]--;
      }
    }
    for (int cc = 0; cc < card.size(); cc++) {
      for (int j = 0; j < card.size(); j++) {
        if (found[j] == 2) continue;
        if (found[j] == 1 && type[j] == 1 && remain[mp[card[j].first]] == 1) {
          remain[mp[card[j].first]]--;
          remain[mp[card[j].second]]--;
          found[j] = 2;
        }
        if (found[j] == 1 && type[j] == 2 && remain[mp[card[j].second]] == 1) {
          remain[mp[card[j].first]]--;
          remain[mp[card[j].second]]--;
          found[j] = 2;
        }
      }
      int gay = 0;
      for (int j = 0; j < card.size(); j++) {
        if (found[j] != 2) gay++;
      }
      if (gay <= 1) {
        ans = min(ans, (int)tmp.size());
      }
    }
  }
  cout << ans;
}
