#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000000")
using namespace std;
const long long int INF = 2e9 + 1;
int main() {
  int n;
  cin >> n;
  scanf("\n");
  vector<pair<int, int> > go(n);
  for (int i = 0; i < (n); i++) {
    char c;
    int a;
    scanf("%c%d ", &c, &a);
    int f;
    switch (c) {
      case 'G':
        f = 0;
        break;
      case 'R':
        f = 1;
        break;
      case 'B':
        f = 2;
        break;
      case 'Y':
        f = 3;
        break;
      case 'W':
        f = 4;
        break;
    }
    a--;
    go[i] = make_pair(f, a);
  }
  int ans = 100500;
  for (int a = 0; a < (1 << 5); a++)
    for (int b = 0; b < (1 << 5); b++) {
      vector<vector<int> > gr;
      vector<int> temp;
      for (int i = 0; i < (n); i++) {
        temp.push_back(i);
      }
      gr.push_back(temp);
      int cnt = 0;
      for (int q = 0; q < (5); q++) {
        if (a & (1 << q)) {
          cnt++;
          int tsz = (int)(gr).size();
          for (int i = 0; i < (tsz); i++) {
            vector<int> f, s;
            for (int j = 0; j < ((int)(gr[i]).size()); j++) {
              int to = gr[i][j];
              if (go[to].first == q)
                f.push_back(to);
              else
                s.push_back(to);
            }
            if ((int)(f).size() < (int)(s).size()) swap(f, s);
            gr[i] = f;
            if ((int)(s).size()) gr.push_back(s);
          }
        }
      }
      for (int q = 0; q < (5); q++) {
        if (b & (1 << q)) {
          cnt++;
          int tsz = (int)(gr).size();
          for (int i = 0; i < (tsz); i++) {
            vector<int> f, s;
            for (int j = 0; j < ((int)(gr[i]).size()); j++) {
              int to = gr[i][j];
              if (go[to].second == q)
                f.push_back(to);
              else
                s.push_back(to);
            }
            if ((int)(f).size() < (int)(s).size()) swap(f, s);
            gr[i] = f;
            if ((int)(s).size()) gr.push_back(s);
          }
        }
      }
      bool yep = false;
      for (int i = 0; i < ((int)(gr).size()); i++) {
        if ((int)(gr[i]).size()) {
          int to = gr[i][0];
          for (int j = 1; j < (int)(gr[i]).size(); j++) {
            int with = gr[i][j];
            if (go[with] != go[to]) yep = true;
          }
        }
      }
      if (!yep) ans = min(ans, cnt);
    }
  cout << ans;
}
