#include <bits/stdc++.h>
using namespace std;
int reader_pt = 1048576, reader_last;
char reader_buf[1048576];
int writer_pt = 0;
char writer_buf[1048576];
void reader(int *x) {
  int k, m = 0;
  *x = 0;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      *x = k - '0';
      break;
    }
  }
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (k) = reader_buf[reader_pt++];
    };
    if (k < '0' || k > '9') break;
    *x = (*x) * 10 + k - '0';
  }
  if (m) (*x) = -(*x);
}
int reader(char c[]) {
  int i, s = 0;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (i) = reader_buf[reader_pt++];
    };
    if (i != ' ' && i != '\n' && i != '\r' && i != '\t' && i != EOF) break;
  }
  c[s++] = i;
  for (;;) {
    {
      if (reader_pt == 1048576)
        reader_pt = 0,
        reader_last = fread(reader_buf, sizeof(char), 1048576, stdin);
      (i) = reader_buf[reader_pt++];
    };
    if (i == ' ' || i == '\n' || i == '\r' || i == '\t' || i == EOF) break;
    c[s++] = i;
  }
  return s;
}
void writer(int x, char c) {
  int i, sz = 0, m = 0;
  char buf[10];
  if (x < 0) m = 1, x = -x;
  while (x) buf[sz++] = x % 10, x /= 10;
  if (!sz) buf[sz++] = 0;
  if (m) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = ('-');
  };
  while (sz--) {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (buf[sz] + '0');
  };
  {
    if (writer_pt == 1048576)
      writer_pt = 0, fwrite(writer_buf, sizeof(char), 1048576, stdout);
    writer_buf[writer_pt++] = (c);
  };
}
int N, in[200];
int mp[10][10], arr[10][10];
char buf[100];
int main() {
  int i, j, k, x, y, xx, yy;
  int res, tmp;
  for (i = 0; i < 10; i++)
    for (j = 0; j < 10; j++) mp[i][j] = 0;
  reader(&N);
  for (i = 0; i < N; i++) {
    reader(buf);
    in[i] = buf[1] - '1';
    if (buf[0] == 'G') in[i] += 5;
    if (buf[0] == 'B') in[i] += 10;
    if (buf[0] == 'Y') in[i] += 15;
    if (buf[0] == 'W') in[i] += 20;
    mp[in[i] / 5][in[i] % 5] = 1;
  }
  res = 1000000;
  for (i = 0; i < 1 << 5; i++)
    for (j = 0; j < 1 << 5; j++) {
      k = 0;
      for (x = 0; x < 6; x++)
        for (y = 0; y < 6; y++) arr[x][y] = 0;
      for (x = 0; x < 5; x++)
        for (y = 0; y < 5; y++)
          if (mp[x][y]) {
            if (i & 1 << x)
              xx = x;
            else
              xx = 5;
            if (j & 1 << y)
              yy = y;
            else
              yy = 5;
            arr[xx][yy]++;
            if (arr[xx][yy] > 1) k = 1;
          }
      if (k) continue;
      tmp = 0;
      for (k = 0; k < 5; k++)
        if (i & 1 << k) tmp++;
      for (k = 0; k < 5; k++)
        if (j & 1 << k) tmp++;
      res = min(res, tmp);
    }
  writer(res, '\n');
  {
    fwrite(writer_buf, sizeof(char), writer_pt, stdout);
    writer_pt = 0;
  };
  return 0;
}
