#include <bits/stdc++.h>
using namespace std;
set<string> cards;
char colors[] = {'R', 'B', 'G', 'W', 'Y'};
map<char, int> bit;
map<char, set<int> > color_to_num;
map<int, set<char> > num_to_color;
int main(void) {
  int b = 0;
  for (auto color : colors) {
    bit[color] = b++;
  }
  int n;
  scanf("%d", &n);
  while (n--) {
    string s;
    cin >> s;
    cards.insert(s);
    color_to_num[s[0]].insert(s[1] - '1');
    num_to_color[s[1] - '1'].insert(s[0]);
  }
  int ans = 200;
  for (int color = 0; color < (1 << 5); color++) {
    for (int num = 0; num < (1 << 5); num++) {
      int n_found = 0;
      set<string> cardsP;
      for (auto card : cards) {
        if ((color & (1 << (bit[card[0]]))) && (num & (1 << (card[1] - '1')))) {
          n_found++;
        } else
          cardsP.insert(card);
      }
      color_to_num.clear();
      num_to_color.clear();
      for (auto card : cardsP) {
        color_to_num[card[0]].insert(card[1] - '1');
        num_to_color[card[1] - '1'].insert(card[0]);
      }
      for (auto card : cardsP) {
        bool found = false;
        if ((color & (1 << (bit[card[0]]))) &&
            color_to_num[card[0]].size() == 1)
          found = true;
        else if ((num & (1 << (card[1] - '1'))) &&
                 num_to_color[card[1] - '1'].size() == 1)
          found = true;
        if (found == true) n_found++;
      }
      color_to_num.clear();
      num_to_color.clear();
      for (auto card : cards) {
        color_to_num[card[0]].insert(card[1] - '1');
        num_to_color[card[1] - '1'].insert(card[0]);
      }
      if ((int)cards.size() - n_found <= 1) {
        int spe = 0;
        if (__builtin_popcount(color) == 5) spe++;
        if (__builtin_popcount(num) == 5) spe++;
        ans = min(ans,
                  -spe + __builtin_popcount(color) + __builtin_popcount(num));
      }
    }
  }
  cout << ans << endl;
  return 0;
}
