#include <bits/stdc++.h>
using namespace std;
vector<string> val;
bool check1[110];
bool check2[110];
char a[5] = {'R', 'G', 'B', 'Y', 'W'};
bool used1[5];
bool used2[5];
char val1[5];
int val2[5];
int ans = 1000 * 1000;
void go2(int pos, int cnt, int cnt2) {
  if (pos == cnt) {
    for (int i = 0; i < val.size(); i++) {
      check1[i] = false;
      check2[i] = false;
    }
    for (int i = 0; i < cnt2; i++) {
      for (int j = 0; j < val.size(); j++) {
        if (val[j][0] == val1[i]) {
          check1[j] = true;
        }
      }
    }
    for (int i = 0; i < cnt; i++) {
      for (int j = 0; j < val.size(); j++) {
        if ((val[j][1] - '0') == val2[i]) check2[j] = true;
      }
    }
    for (int i = 0; i < val.size(); i++) {
      if (check1[i] == true && check2[i]) continue;
      if (check1[i] && !check2[i]) {
        for (int j = i + 1; j < val.size(); j++) {
          if (check1[j] && !check2[j])
            if (val[i][1] != val[j][1] && val[i][0] == val[j][0]) return;
        }
      }
      if (!check1[i] && check2[i]) {
        for (int j = i + 1; j < val.size(); j++) {
          if (!check1[j] && check2[j]) {
            if (val[i][0] != val[j][0] && val[i][1] == val[j][1]) return;
          }
        }
      }
      if (!check1[i] && !check2[i]) {
        for (int j = i + 1; j < val.size(); j++) {
          if (!check1[j] && !check2[j])
            if (val[i] != val[j]) return;
        }
      }
    }
    if (ans > cnt + cnt2) ans = cnt + cnt2;
  } else {
    for (int i = 0; i < 5; i++) {
      if (!used2[i]) {
        used2[i] = true;
        val2[pos] = i + 1;
        go2(pos + 1, cnt, cnt2);
        used2[i] = false;
      }
    }
  }
}
void go1(int pos, int cnt) {
  if (pos == cnt) {
    go2(0, 0, cnt);
    go2(0, 1, cnt);
    go2(0, 2, cnt);
    go2(0, 3, cnt);
    go2(0, 4, cnt);
    go2(0, 5, cnt);
  } else {
    for (int i = 0; i < 5; i++) {
      if (!used1[i]) {
        used1[i] = true;
        val1[pos] = a[i];
        go1(pos + 1, cnt);
        used1[i] = false;
      }
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    val.push_back(s);
  }
  go1(0, 0);
  go1(0, 1);
  go1(0, 2);
  go1(0, 3);
  go1(0, 4);
  go1(0, 5);
  cout << ans << endl;
  return 0;
}
