#include <bits/stdc++.h>
using namespace std;
int n;
int C[5][5];
bool CK[5][5];
bool NK[5][5];
int main() {
  scanf("%d", &n);
  char c, d;
  int i, j;
  for (int cc = 0; cc < n; cc++) {
    cin >> c;
    cin >> d;
    j = d - '1';
    if (c == 'R')
      i = 0;
    else if (c == 'G')
      i = 1;
    else if (c == 'B')
      i = 2;
    else if (c == 'Y')
      i = 3;
    else
      i = 4;
    C[i][j]++;
  }
  int mn = 10;
  for (int s = 0; s < (1 << 10); s++) {
    int cnt = 0;
    for (int i = 0; i < 10; i++)
      if ((1 << i) & s) cnt++;
    int ck = s % 32, nk = s / 32;
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 5; j++) CK[i][j] = NK[i][j] = false;
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 5; j++) {
        if ((1 << i) & ck) CK[i][j] = true;
        if ((1 << j) & nk) NK[i][j] = true;
        if (C[i][j] == 0) CK[i][j] = NK[i][j] = true;
      }
    bool go = true;
    while (go) {
      go = false;
      int uk, ukc = 0;
      for (int i = 0; i < 5; i++) {
        bool all = true;
        for (int j = 0; j < 5; j++) all &= CK[i][j];
        if (!all) {
          ukc++;
          uk = i;
        }
      }
      if (ukc == 1) {
        for (int j = 0; j < 5; j++) CK[uk][j] = true;
        go = true;
      }
      ukc = 0;
      for (int j = 0; j < 5; j++) {
        bool all = true;
        for (int i = 0; i < 5; i++) all &= NK[i][j];
        if (!all) {
          ukc++;
          uk = j;
        }
      }
      if (ukc == 1) {
        for (int i = 0; i < 5; i++) NK[i][uk] = true;
        go = true;
      }
      for (int i = 0; i < 5; i++)
        for (int j = 0; j < 5; j++) {
          if (NK[i][j] && CK[i][j]) continue;
          if (NK[i][j]) {
            bool all = true;
            for (int k = 0; k < 5; k++)
              if (k != i) all &= NK[k][j] & CK[k][j];
            if (all) {
              CK[i][j] = true;
              go = true;
              continue;
            }
          } else if (CK[i][j]) {
            bool all = true;
            for (int k = 0; k < 5; k++)
              if (k != j) all &= NK[i][k] & CK[i][k];
            if (all) {
              NK[i][j] = true;
              go = true;
            }
          }
        }
    }
    bool all = true;
    for (int i = 0; i < 5; i++)
      for (int j = 0; j < 5; j++) all &= (CK[i][j] & NK[i][j]);
    if (all) mn = min(cnt, mn);
  }
  cout << mn << endl;
  return 0;
}
