#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
inline T LCM(T a, T b) {
  if (a < 0) return LCM(-a, b);
  if (b < 0) return LCM(a, -b);
  return a * (b / gcd(a, b));
}
map<char, int> arr;
int m[5][5];
int temp[5][5];
int check(unsigned int n) {
  int i = 0;
  int ans = 0;
  vector<char> col;
  vector<char> num;
  for (int k = 0; k < 5; k++)
    for (int z = 0; z < 5; z++) temp[k][z] = m[k][z];
  while (n > 0) {
    if (n % 2 == 1) {
      ans++;
      if (i == 0)
        col.push_back('R');
      else if (i == 1)
        col.push_back('G');
      else if (i == 2)
        col.push_back('B');
      else if (i == 3)
        col.push_back('Y');
      else if (i == 4)
        col.push_back('W');
      else if (i == 5)
        num.push_back('1');
      else if (i == 6)
        num.push_back('2');
      else if (i == 7)
        num.push_back('3');
      else if (i == 8)
        num.push_back('4');
      else if (i == 9)
        num.push_back('5');
    }
    n = n >> 1;
    i++;
  }
  for (int k = 0; k < col.size(); k++) {
    for (int z = 0; z < num.size(); z++) {
      temp[arr[col[k]]][arr[num[z]]] = 0;
    }
  }
  for (int k = 0; k < 25; k++) {
    for (int z = 0; z < col.size(); z++) {
      int pos = -1;
      for (int a = 0; a < 5; a++) {
        if (temp[arr[col[z]]][a] == 1) {
          if (pos == -1)
            pos = a;
          else
            pos = -2;
        }
      }
      if (pos > -1) {
        temp[arr[col[z]]][pos] = 0;
      }
    }
    for (int z = 0; z < num.size(); z++) {
      int pos = -1;
      for (int a = 0; a < 5; a++) {
        if (temp[a][arr[num[z]]] == 1) {
          if (pos == -1)
            pos = a;
          else
            pos = -2;
        }
      }
      if (pos > -1) {
        temp[pos][arr[num[z]]] = 0;
      }
    }
  }
  bool al = false;
  for (int z = 0; z < 5; z++) {
    for (int k = 0; k < 5; k++) {
      if (temp[z][k] == 1) {
        if (!al) {
          al = true;
        } else {
          return -1;
        }
      }
    }
  }
  return ans;
}
int main() {
  arr['R'] = 0;
  arr['G'] = 1;
  arr['B'] = 2;
  arr['Y'] = 3;
  arr['W'] = 4;
  arr['1'] = 0;
  arr['2'] = 1;
  arr['3'] = 2;
  arr['4'] = 3;
  arr['5'] = 4;
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 5; j++) m[i][j] = 0;
  int n;
  cin >> n;
  char in[3];
  int ans = 25;
  int temp;
  for (unsigned i = 0; i < n; i++) {
    scanf("%s", in);
    m[arr[in[0]]][arr[in[1]]] = 1;
  }
  for (unsigned int i = 0; i < 1024; i++) {
    temp = check(i);
    if (temp > -1) ans = min(ans, temp);
  }
  printf("%d", ans);
  return 0;
}
