#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000");
using namespace std;
int Judge(char s) {
  if (s == 'R') return 1;
  if (s == 'G') return 2;
  if (s == 'B') return 3;
  if (s == 'Y') return 4;
  return 5;
}
bool mark[10][10];
bool Cal(int x, int sta) {
  if (sta & (1 << x)) return true;
  return false;
}
int main() {
  int n, i, j, k;
  scanf("%d", &n);
  char s[10];
  memset(mark, false, sizeof(mark));
  for (i = 1; i <= n; ++i) {
    scanf("%s", s);
    mark[Judge(s[0])][s[1] - '0'] = true;
  }
  int sta = (1 << 10) - 1;
  int Min = 25;
  while (sta >= 0) {
    int temp = 0;
    for (i = 0; i <= 9; ++i) {
      if (sta & (1 << i)) temp++;
    }
    if (temp >= Min) {
      sta--;
      continue;
    }
    bool flag = false;
    for (i = 1; i <= 5; ++i) {
      for (j = 1; j <= 5; ++j) {
        if (mark[i][j] == true) {
          if (Cal(i - 1, sta) && Cal(j + 4, sta)) continue;
          if (Cal(i - 1, sta) == false && Cal(j + 4, sta) == false) {
            if (flag == false) {
              flag = true;
            } else {
              temp = 100;
            }
          } else {
            if (Cal(i - 1, sta)) {
              for (k = j - 1; k >= 1; k--) {
                if (mark[i][k] && Cal(k + 4, sta) == false) temp = 100;
              }
              for (k = j + 1; k <= 5; k++) {
                if (mark[i][k] && Cal(k + 4, sta) == false) temp = 100;
              }
            } else if (Cal(j + 4, sta)) {
              for (k = i - 1; k >= 1; k--) {
                if (mark[k][j] && Cal(k - 1, sta) == false) temp = 100;
              }
              for (k = i + 1; k <= 5; k++) {
                if (mark[k][j] && Cal(k - 1, sta) == false) temp = 100;
              }
            }
          }
        }
      }
    }
    Min = min(temp, Min);
    sta--;
  }
  printf("%d\n", Min);
  return 0;
}
