#include <bits/stdc++.h>
using namespace std;
const int N = 109;
const int INF = 1e9;
char zbs[5] = {'R', 'G', 'B', 'Y', 'W'};
pair<int, int> a[N];
int main() {
  int n, ans = 11;
  cin >> n;
  for (int i = 0; i < int(n); ++i) {
    char t1, t2;
    cin >> t1 >> t2;
    a[i].second = int(t2 - '1');
    for (int j = 0; j < int(5); ++j)
      if (zbs[j] == t1) a[i].first = j;
  }
  for (int mask1 = 0; mask1 < int(1 << 5); ++mask1) {
    for (int mask2 = 0; mask2 < int(1 << 5); ++mask2) {
      int m[5][5], na = 0, ok = 1;
      memset(m, 0, sizeof(m));
      for (int i = 0; i < int(5); ++i) {
        if (mask1 & (1 << i)) ++na;
        if (mask2 & (1 << i)) ++na;
      }
      for (int i = 0; i < int(n); ++i) m[a[i].first][a[i].second] = 1;
      for (int i1 = 0; i1 < int(5); ++i1)
        for (int j1 = 0; j1 < int(5); ++j1)
          for (int i2 = 0; i2 < int(5); ++i2)
            for (int j2 = 0; j2 < int(5); ++j2) {
              bool ok1 = 0;
              if (m[i1][j1] * m[i2][j2] == 0) continue;
              if (i1 == i2 && j1 == j2) continue;
              if (i1 != i2 && ((mask1 & (1 << i1)) || (mask1 & (1 << i2))))
                ok1 = 1;
              if (j1 != j2 && ((mask2 & (1 << j1)) || (mask2 & (1 << j2))))
                ok1 = 1;
              if (ok) ok = ok1;
            }
      if (ok) ans = min(na, ans);
    }
  }
  cout << ans;
}
