#include <bits/stdc++.h>
using namespace std;
set<char> Set, Set1;
map<char, char> Map;
vector<int> v;
string s[181], s1[181];
char c;
int mx[6][6][2], mx1[6][6][2], n, i, j, z, mask, mask1, bit, sum, kol, kol1,
    ans;
bool x;
char get(int a, int b) {
  int i, kol = 0, nom = 0;
  for (i = 1; i <= 5; i++)
    if (mx[a][i][b] > 0) {
      kol++;
      if (kol > 1) return '0';
      nom = i;
    }
  return char(nom + 48);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  Map['R'] = '1';
  Map['G'] = '2';
  Map['B'] = '3';
  Map['Y'] = '4';
  Map['W'] = '5';
  for (i = 1; i <= n; i++) {
    cin >> s[i];
    s[i][0] = Map[s[i][0]];
    mx[s[i][0] - 48][s[i][1] - 48][0]++;
    mx[s[i][1] - 48][s[i][0] - 48][1]++;
  }
  for (i = 1; i <= 5; i++)
    for (j = 1; j <= 5; j++)
      for (z = 0; z <= 1; z++) mx1[i][j][z] = mx[i][j][z];
  ans = 2000000000;
  for (mask = 0; mask < 32; mask++)
    for (mask1 = 0; mask1 < 32; mask1++) {
      Set.clear();
      Set1.clear();
      for (i = 1; i <= 5; i++)
        for (j = 1; j <= 5; j++)
          for (z = 0; z <= 1; z++) mx[i][j][z] = mx1[i][j][z];
      kol = kol1 = 0;
      for (bit = 0; bit < 5; bit++)
        if ((mask >> bit) % 2 == 1) {
          kol++;
          Set.insert(bit + 1);
        }
      for (bit = 0; bit < 5; bit++)
        if ((mask1 >> bit) % 2 == 1) {
          kol++;
          Set1.insert(bit + 1);
        }
      for (i = 1; i <= n; i++) s1[i] = "##";
      for (i = 1; i <= n; i++) {
        if (Set.find(s[i][0] - 48) != Set.end()) {
          kol1++;
          s1[i][0] = s[i][0];
        }
        if (Set1.find(s[i][1] - 48) != Set1.end()) {
          kol1++;
          s1[i][1] = s[i][1];
        }
        if (s1[i].find("#") == string::npos) {
          mx[s1[i][0] - 48][s1[i][1] - 48][0]--;
          mx[s1[i][1] - 48][s1[i][0] - 48][1]--;
        }
      }
      do {
        x = false;
        for (i = 1; i <= n; i++)
          if (s1[i][0] != '#' && s1[i][1] == '#') {
            c = get(s1[i][0] - 48, 0);
            if (c != '0') {
              x = true;
              kol1++;
              s1[i][1] = c;
              mx[s1[i][0] - 48][s1[i][1] - 48][0]--;
              mx[s1[i][1] - 48][s1[i][0] - 48][1]--;
            }
          }
        for (i = 1; i <= n; i++)
          if (s1[i][0] == '#' && s1[i][1] != '#') {
            c = get(s1[i][1] - 48, 1);
            if (c != '0') {
              x = true;
              kol1++;
              s1[i][0] = c;
              mx[s1[i][0] - 48][s1[i][1] - 48][0]--;
              mx[s1[i][1] - 48][s1[i][0] - 48][1]--;
            }
          }
        for (z = 1; z <= 5; z++) {
          sum = 0;
          for (i = 1; i <= 5; i++) sum += mx[z][i][0];
          v.clear();
          for (i = 1; i <= n; i++)
            if (s1[i][0] == '#') {
              if (s1[i][1] == '#') {
                v.push_back(i);
                continue;
              }
              if (mx[z][s1[i][1] - 48][0] > 0) v.push_back(i);
            }
          if (v.size() == sum) {
            for (i = 0; i < v.size(); i++) {
              x = true;
              kol1++;
              s1[v[i]][0] = char(z + 48);
              if (s1[v[i]][1] != '#') {
                mx[s1[v[i]][0] - 48][s1[v[i]][1] - 48][0]--;
                mx[s1[v[i]][1] - 48][s1[v[i]][0] - 48][1]--;
              }
            }
          }
        }
        for (z = 1; z <= 5; z++) {
          sum = 0;
          for (i = 1; i <= 5; i++) sum += mx[z][i][1];
          v.clear();
          for (i = 1; i <= n; i++)
            if (s1[i][1] == '#') {
              if (s1[i][0] == '#') {
                v.push_back(i);
                continue;
              }
              if (mx[z][s1[i][0] - 48][1] > 0) v.push_back(i);
            }
          if (v.size() == sum) {
            for (i = 0; i < v.size(); i++) {
              x = true;
              kol1++;
              s1[v[i]][1] = char(z + 48);
              if (s1[v[i]][0] != '#') {
                mx[s1[v[i]][0] - 48][s1[v[i]][1] - 48][0]--;
                mx[s1[v[i]][1] - 48][s1[v[i]][0] - 48][1]--;
              }
            }
          }
        }
      } while (x);
      if (kol1 == n * 2) ans = min(ans, kol);
    }
  cout << ans << '\n';
  return 0;
}
