#include <bits/stdc++.h>
using namespace std;
int n;
string cards[105];
map<char, int> m;
bool is_distinguishable(string a, string b, int mask) {
  if (a == b) return true;
  if (a[0] == b[0])
    return (((1 << (a[1] - '0' - 1)) & mask) != 0) ||
           (((1 << (b[1] - '0' - 1)) & mask) != 0);
  if (a[1] == b[1])
    return (((1 << m[a[0]]) & mask) != 0) || (((1 << m[b[0]]) & mask) != 0);
  return (((1 << (a[1] - '0' - 1)) & mask) != 0) ||
         (((1 << (b[1] - '0' - 1)) & mask) != 0) ||
         (((1 << m[a[0]]) & mask) != 0) || (((1 << m[b[0]]) & mask) != 0);
}
bool is_valid_hint(int mask) {
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (!is_distinguishable(cards[i], cards[j], mask)) return false;
    }
  }
  return true;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> cards[i];
  }
  m['R'] = 5;
  m['G'] = 6;
  m['B'] = 7;
  m['Y'] = 8;
  m['W'] = 9;
  int y = 1 << 10;
  int ans = 10;
  for (int mask = 0; mask < y; mask++) {
    if (is_valid_hint(mask)) ans = min(ans, __builtin_popcount(mask));
  }
  cout << ans;
  return 0;
}
