#include <bits/stdc++.h>
using namespace std;
bool dbg = 0;
void bad(string mes = "Impossible") {
  cout << mes;
  exit(0);
}
template <typename T>
string bin(T x, int st = 2) {
  string ans = "";
  while (x > 0) {
    ans += char('0' + x % st);
    x /= st;
  }
  reverse(ans.begin(), ans.end());
  return ans.empty() ? "0" : ans;
}
template <typename T>
T input() {
  T ans = 0, m = 1;
  char c = ' ';
  while (!((c >= '0' && c <= '9') || c == '-')) {
    c = getchar();
  }
  if (c == '-') m = -1, c = getchar();
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + (c - '0'), c = getchar();
  }
  return ans * m;
}
template <typename T>
void read(T& a) {
  a = input<T>();
}
template <typename T>
void read(T& a, T& b) {
  read(a), read(b);
}
template <typename T>
void read(T& a, T& b, T& c) {
  read(a, b), read(c);
}
template <typename T>
void read(T& a, T& b, T& c, T& d) {
  read(a, b), read(c, d);
}
void reads(string& second) {
  string ans = "";
  char c = '\n';
  while (c == '\n' || c == ' ') c = getchar();
  while (c != '\n' && c != ' ' && c) ans += c, c = getchar();
  second = ans;
}
const int inf = 1e9;
const long double eps = 1e-12;
const int maxn = 5e5 + 10, base = 1e9 + 7;
const long long llinf = 1e18 + 5;
template <typename T>
T binpow(T n, T second) {
  if (second <= 0) return 1LL;
  if (second % 2 == 0) {
    T b = binpow(n, second / 2);
    return (1LL * b * b) % base;
  } else {
    return (1LL * binpow(n, second - 1) * n) % base;
  }
}
bool can(vector<pair<int, int> >& a, int cmask, int nmask) {
  int pairColor[5], pairNumber[5];
  for (int i = 0; i < 5; i++) pairColor[i] = -1, pairNumber[i] = -1;
  pair<int, int> unk = make_pair(-1, -1);
  for (int i = 0; i < a.size(); i++) {
    int c = -1, n = -1;
    if (cmask & (1 << a[i].first)) c = a[i].first;
    if (nmask & (1 << a[i].second)) n = a[i].second;
    if (c != -1 && n == -1) {
      if (pairColor[c] != -1 && pairColor[c] != a[i].second) return false;
      pairColor[c] = a[i].second;
    }
    if (n != -1 && c == -1) {
      if (pairNumber[n] != -1 && pairNumber[n] != a[i].first) return false;
      pairNumber[n] = a[i].first;
    }
    if (c == -1 && n == -1) {
      if (unk != make_pair(-1, -1) && unk != a[i]) return false;
      unk = a[i];
    }
  }
  return true;
}
int main() {
  map<char, int> color;
  color['R'] = 0, color['G'] = 1, color['B'] = 2, color['Y'] = 3,
  color['W'] = 4;
  int n;
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  vector<pair<int, int> > tmp, unq;
  for (int i = 0; i < n; i++) {
    char C, N;
    cin >> C >> N;
    int b1 = color[C], b2 = N - '1';
    tmp.push_back(make_pair(b1, b2));
  }
  sort((tmp).begin(), (tmp).end());
  for (int i = 0; i < n; i++) {
    if (i == 0 || tmp[i] != tmp[i - 1]) {
      unq.push_back(tmp[i]);
    }
  }
  int ans = inf;
  for (int mask1 = 0; mask1 < (1 << 5); mask1++)
    for (int mask2 = 0; mask2 < (1 << 5); mask2++) {
      if (can(unq, mask1, mask2))
        ans = min(ans, __builtin_popcount(mask1) + __builtin_popcount(mask2));
    }
  cout << ans;
  return 0;
}
