#include <bits/stdc++.h>
using namespace std;
map<char, int> color_num;
bool T[5][5] = {0}, left_type[5][5];
int leftX[5], leftY[5];
int bcnt(int m) {
  int ret = 0;
  while (m) {
    ret += (m & 1);
    m >>= 1;
  }
  return ret;
}
int main() {
  color_num['R'] = 0;
  color_num['G'] = 1;
  color_num['B'] = 2;
  color_num['Y'] = 3;
  color_num['W'] = 4;
  int n, i, j, k;
  char buf[5];
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%s", buf);
    T[color_num[buf[0]]][buf[1] - '0' - 1] = true;
  }
  int ans = 10, tmp;
  int mask, nleft;
  for (mask = 0; mask < (1 << 10); ++mask) {
    memcpy(left_type, T, 25 * sizeof(bool));
    for (i = 0; i < 5; ++i)
      for (j = 0; j < 5; ++j)
        if ((mask & (1 << i)) && (mask & (1 << (j + 5))))
          left_type[i][j] = false;
    for (i = 0; i < 5; ++i) {
      leftX[i] = 0;
      for (j = 0; j < 5; ++j) leftX[i] += left_type[i][j];
    }
    for (j = 0; j < 5; ++j) {
      leftY[j] = 0;
      for (i = 0; i < 5; ++i) leftY[j] += left_type[i][j];
    }
    for (k = 0; k < 12; ++k)
      for (i = 0; i < 5; ++i)
        for (j = 0; j < 5; ++j)
          if (left_type[i][j]) {
            if (leftX[i] == 1 && (mask & (1 << i))) {
              left_type[i][j] = false;
              --leftX[i];
              --leftY[j];
            }
            if (leftY[j] == 1 && (mask & (1 << (j + 5)))) {
              left_type[i][j] = false;
              --leftX[i];
              --leftY[j];
            }
          }
    nleft = 0;
    for (i = 0; i < 5; ++i)
      for (j = 0; j < 5; ++j) nleft += left_type[i][j];
    if (nleft <= 1) {
      tmp = bcnt(mask);
      if (tmp < ans) ans = tmp;
    }
  }
  printf("%d\n", ans);
  return 0;
}
