#include <bits/stdc++.h>
using namespace std;
int iterateColor(bool[5][5], bool[], bool[], int, int);
int iterateNumber(bool[5][5], bool[], bool[], int, int);
bool judge(bool[5][5], bool[], bool[]);
int idfor(char);
int main(int argc, char** args) {
  int n;
  cin >> n;
  bool arr[5][5] = {};
  bool mc[5] = {false}, mi[5] = {false};
  int x = 0;
  for (int i = 0; i < n; i++) {
    char ch;
    int id;
    cin >> ch >> id;
    id -= 1;
    int cl = idfor(ch);
    arr[cl][id] = true;
    if (!mc[cl]) ++x;
    if (!mi[id]) ++x;
    mc[cl] = true, mi[id] = true;
  }
  int mt = 0;
  if (x > 0) mt = iterateColor(arr, mc, mi, -1, 0);
  cout << x - mt;
  return 0;
}
int idfor(char ch) {
  if (ch == 'R') return 0;
  if (ch == 'G') return 1;
  if (ch == 'B') return 2;
  if (ch == 'Y') return 3;
  return 4;
}
int iterateColor(bool arr[5][5], bool mc[5], bool mi[5], int lm, int ans) {
  int n1 = ans + 1;
  if (!judge(arr, mc, mi)) return ans - 1;
  if (lm < 4) {
    for (int i = lm + 1; i < 5; i++) {
      if (!mc[i]) continue;
      bool mc2[5];
      memcpy(mc2, mc, sizeof(bool) * 5);
      mc2[i] = false;
      int n2 = iterateColor(arr, mc2, mi, i, ans + 1);
      if (n2 > n1) n1 = n2;
      n2 = iterateNumber(arr, mc2, mi, -1, ans + 1);
      if (n2 > n1) n1 = n2;
    }
    return n1;
  } else
    return iterateNumber(arr, mc, mi, -1, ans);
}
int iterateNumber(bool arr[5][5], bool mc[5], bool mi[5], int lm, int ans) {
  if (!judge(arr, mc, mi)) return ans - 1;
  if (lm < 4) {
    int n1 = ans;
    for (int i = lm + 1; i < 5; i++) {
      if (!mi[i]) continue;
      bool mi2[5];
      memcpy(mi2, mi, sizeof(bool) * 5);
      mi2[i] = false;
      int n = iterateNumber(arr, mc, mi2, i, ans + 1);
      if (n > n1) n1 = n;
    }
    return n1;
  } else
    return ans;
}
bool judge(bool arr[5][5], bool mc[5], bool mi[5]) {
  bool mc2[5], mi2[5];
  memcpy(mc2, mc, 5 * sizeof(bool));
  memcpy(mi2, mi, 5 * sizeof(bool));
  int nall = 0;
  int kc[5] = {}, ki[5] = {};
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      if (arr[i][j]) {
        if (!mc[i] && !mi[j]) {
          nall++;
        } else if (mc[i] && !mi[j]) {
          ++kc[i];
        } else if (!mc[i] && mi[j]) {
          ++ki[j];
        }
      }
    }
  }
  if (nall > 1) return false;
  for (int i = 0; i < 5; i++)
    if (kc[i] > 1 || ki[i] > 1) return false;
  return true;
}
