#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-5;
char colortable[] = {'R', 'G', 'B', 'Y', 'W'};
int getX(string s) {
  for (int i = 0; i < 5; i++) {
    if (colortable[i] == s[0]) return i;
  }
  return -1;
}
int getY(string s) { return s[1] - '1'; }
int bitcount(int b) {
  int ans = 0;
  while (b != 0) {
    ans++;
    b &= b - 1;
  }
  return ans;
}
bool check(int maskX, int maskY, string C1, string C2) {
  int x1 = getX(C1);
  int x2 = getX(C2);
  int y1 = getY(C1);
  int y2 = getY(C2);
  if (x1 == x2 && y1 == y2) return true;
  if (x1 != x2) {
    if ((maskX & (1 << x1)) != 0 || (maskX & (1 << x2)) != 0) return true;
  }
  if (y1 != y2) {
    if ((maskY & (1 << y1)) != 0 || (maskY & (1 << y2)) != 0) return true;
  }
  return false;
}
int main() {
  int n;
  cin >> n;
  vector<string> cards(n);
  for (int i = 0; i < n; i++) cin >> cards[i];
  int ans = 100000;
  sort(cards.begin(), cards.end());
  cards.erase(unique(cards.begin(), cards.end()), cards.end());
  for (int maskX = 0; maskX < (1 << 5); maskX++) {
    for (int maskY = 0; maskY < (1 << 5); maskY++) {
      bool ok = true;
      for (int i = 0; ok && (i < (int)cards.size()); i++) {
        for (int j = i + 1; ok && (j < (int)cards.size()); j++) {
          ok = check(maskX, maskY, cards[i], cards[j]);
        }
      }
      if (ok) {
        ans = min(ans, bitcount(maskX) + bitcount(maskY));
      }
    }
  }
  cout << ans << endl;
  return 0;
}
