#include <bits/stdc++.h>
using namespace std;
int mini;
map<char, int> M;
set<int> s;
int n;
void rec(int ind, vector<int> c, vector<int> d) {
  if (ind == 10) {
    int rem = n;
    int X = c.size() + d.size();
    int i, j;
    set<int> S = s;
    set<int>::iterator it;
    for (i = 0; i < c.size(); i++) {
      for (j = 0; j < d.size(); j++) {
        if (S.find(5 * c[i] + d[j]) != S.end()) {
          S.erase(5 * c[i] + d[j]);
        }
      }
    }
    for (i = 0; i < c.size(); i++) {
      int count = 0, flag;
      for (j = 0; j < 5; j++) {
        if (S.find(5 * c[i] + j) != S.end()) {
          count++;
          flag = j;
        }
      }
      if (count == 1) {
        S.erase(5 * c[i] + flag);
      }
    }
    for (i = 0; i < d.size(); i++) {
      int count = 0, flag;
      for (j = 0; j < 5; j++) {
        if (S.find(5 * j + d[i]) != S.end()) {
          count++;
          flag = j;
        }
      }
      if (count == 1) {
        S.erase(5 * flag + d[i]);
      }
    }
    if (S.size() == 1 || S.size() == 0) {
      mini = min(mini, X);
    }
    return;
  }
  if (ind < 5) {
    rec(ind + 1, c, d);
    c.push_back(ind);
    rec(ind + 1, c, d);
  } else {
    rec(ind + 1, c, d);
    d.push_back(ind - 5);
    rec(ind + 1, c, d);
  }
}
int main() {
  mini = 10;
  M['R'] = 0;
  M['G'] = 1;
  M['B'] = 2;
  M['Y'] = 3;
  M['W'] = 4;
  cin >> n;
  int i;
  string st;
  for (i = 0; i < n; i++) {
    cin >> st;
    s.insert(5 * M[st[0]] + st[1] - '1');
  }
  vector<int> c;
  vector<int> d;
  rec(0, c, d);
  cout << mini << endl;
  return 0;
}
