#include <bits/stdc++.h>
using namespace std;
int n, d[305], mn = 10, p, q, c, v;
pair<char, int> a[(105)];
pair<int, int> h[(105)];
int bit(int x) { return !x ? 0 : bit(x - (x & -x)) + 1; }
int ok(int x, int y) {
  memset(h, 0, sizeof(h));
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= 4; j++) {
      if (x & (1 << j) and a[i].first == j + 1) h[i].first = 1;
      if (y & (1 << j) and a[i].second == j + 1) h[i].second = 1;
    }
  for (int i = 1; i <= n; i++) {
    if (!h[i].first and h[i].second) {
      int c = 0;
      for (int j = 1; j <= n; j++)
        if (i != j and !h[j].first and a[i].second == a[j].second) {
          c = 1;
          break;
        }
      if (!c) h[i].first = 1;
    }
    if (h[i].first and !h[i].second) {
      int c = 0;
      for (int j = 1; j <= n; j++)
        if (i != j and !h[j].second and a[i].first == a[j].first) {
          c = 1;
          break;
        }
      if (!c) h[i].second = 1;
    }
  }
  p = q = 0;
  for (int i = 1; i <= n; i++) {
    if (!h[i].first)
      if (!p) {
        c = a[i].first;
        p = 1;
      } else if (a[i].first != c)
        return 0;
    if (!h[i].second)
      if (!q) {
        v = a[i].second;
        q = 1;
      } else if (a[i].second != v)
        return 0;
  }
  return 1;
}
int main() {
  d['R'] = 1;
  d['G'] = 2;
  d['B'] = 3;
  d['Y'] = 4;
  d['W'] = 5;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    char ch;
    int in;
    cin >> ch >> in;
    a[i].first = d[ch];
    a[i].second = in;
  }
  sort(a + 1, a + n + 1);
  n = unique(a + 1, a + n + 1) - a - 1;
  for (int i = 0; i <= (1 << 5) - 1; i++)
    for (int j = 0; j <= (1 << 5) - 1; j++)
      if (ok(i, j)) mn = min(mn, bit(i) + bit(j));
  cout << mn << '\n';
  return 0;
}
