#include <bits/stdc++.h>
using namespace std;
struct C {
  char oc, on;
};
int total, mn;
C card[30];
map<int, bool> state;
void brute(int state_in[], int cnt) {
  bool is_double, exist[10][10];
  char temp[5];
  int iemp;
  iemp = 0;
  for (int i = 0; i <= total - 1; i++) {
    iemp *= 10;
    iemp += state_in[i];
  }
  if (state.count(iemp) != 0) return;
  state[iemp] = true;
  for (int i = 0; i <= 5; i++)
    for (int j = 0; j <= 5; j++) exist[i][j] = false;
  is_double = false;
  for (int i = 0; i <= total - 1; i++) {
    if (state_in[i] == 0) {
      temp[0] = 'F';
      temp[1] = '6';
    } else if (state_in[i] == 1) {
      temp[0] = card[i].oc;
      temp[1] = '6';
    } else if (state_in[i] == 2) {
      temp[0] = 'F';
      temp[1] = card[i].on;
    } else {
      temp[0] = card[i].oc;
      temp[1] = card[i].on;
    }
    if (exist[temp[0] - 'A'][temp[1] - '1']) {
      is_double = true;
      break;
    }
    exist[temp[0] - 'A'][temp[1] - '1'] = true;
  }
  if (!is_double) {
    mn = min(mn, cnt);
    return;
  }
  for (int i = 0; i <= total - 1; i++) {
    if (state_in[i] == 3) continue;
    if (state_in[i] != 1) {
      for (int j = 0; j <= total - 1; j++) {
        if (card[j].oc == card[i].oc) {
          if (state_in[j] == 0)
            state_in[j] = 1;
          else if (state_in[j] == 2)
            state_in[j] = 3;
        }
      }
      brute(state_in, cnt + 1);
      for (int j = 0; j <= total - 1; j++) {
        if (card[j].oc == card[i].oc) {
          if (state_in[j] == 1)
            state_in[j] = 0;
          else if (state_in[j] == 3)
            state_in[j] = 2;
        }
      }
    }
    if (state_in[i] != 2) {
      for (int j = 0; j <= total - 1; j++) {
        if (card[j].on == card[i].on) {
          if (state_in[j] == 0)
            state_in[j] = 2;
          else if (state_in[j] == 1)
            state_in[j] = 3;
        }
      }
      brute(state_in, cnt + 1);
      for (int j = 0; j <= total - 1; j++) {
        if (card[j].on == card[i].on) {
          if (state_in[j] == 2)
            state_in[j] = 0;
          else if (state_in[j] == 3)
            state_in[j] = 1;
        }
      }
    }
  }
}
int main() {
  int n, state_in[30];
  char input[5];
  bool exist[10][10];
  for (int i = 0; i <= 5; i++)
    for (int j = 0; j <= 5; j++) exist[i][j] = false;
  total = 0;
  mn = 2000000000;
  scanf("%d", &n);
  for (int i = 0; i <= n - 1; i++) {
    scanf("%s", input);
    if (input[0] == 'R')
      input[0] = 'A';
    else if (input[0] == 'G')
      input[0] = 'B';
    else if (input[0] == 'B')
      input[0] = 'C';
    else if (input[0] == 'Y')
      input[0] = 'D';
    else
      input[0] = 'E';
    if (!exist[input[0] - 'A'][input[1] - '1']) {
      card[total].oc = input[0];
      card[total].on = input[1];
      total++;
      exist[input[0] - 'A'][input[1] - '1'] = true;
    }
  }
  for (int i = 0; i <= total - 1; i++) state_in[i] = 0;
  brute(state_in, 0);
  printf("%d", mn);
  return 0;
}
