#include <bits/stdc++.h>
using namespace std;
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
string cards[105];
int N;
bool mark[105];
bool good(int ii, int jj) {
  int num = 0;
  memset(mark, 0, sizeof(mark));
  for (int i = 0; i < N; i++) {
    int iii = cards[i][0] - 'A';
    int jjj = cards[i][1] - '1';
    if ((ii & (1 << iii)) && (jj & (1 << jjj))) {
      num++;
      mark[i] = true;
    }
  }
  if (num + 1 >= N) return 1;
  num = 0;
  for (int i = 0; i < N; i++) {
    int iii = cards[i][0] - 'A';
    int jjj = cards[i][1] - '1';
    if ((ii & (1 << iii)) && (jj & (1 << jjj))) {
    } else if (ii & (1 << iii)) {
      for (int j = 0; j < N; j++) {
        if (cards[j][0] == cards[i][0] && cards[j][1] != cards[i][1]) {
          if (!mark[j]) return false;
        }
      }
    } else if (jj & (1 << jjj)) {
      for (int j = 0; j < N; j++) {
        if (cards[j][0] != cards[i][0] && cards[j][1] == cards[i][1]) {
          if (!mark[j]) return false;
        }
      }
    } else {
      num++;
    }
  }
  return (num <= 1);
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> cards[i];
    if (cards[i][0] == 'R')
      cards[i][0] = 'A';
    else if (cards[i][0] == 'G')
      cards[i][0] = 'B';
    else if (cards[i][0] == 'B')
      cards[i][0] = 'C';
    else if (cards[i][0] == 'Y')
      cards[i][0] = 'D';
    else
      cards[i][0] = 'E';
  }
  sort(cards, cards + N);
  N = unique(cards, cards + N) - cards;
  int minn = 100000;
  for (int i = 0; i < 1 << 5; i++) {
    for (int j = 0; j < 1 << 5; j++) {
      if (good(i, j)) {
        minn = min(minn, __builtin_popcount(i) + __builtin_popcount(j));
      }
    }
  }
  cout << minn << endl;
  return 0;
}
