#include <bits/stdc++.h>
using namespace std;
int vis[5][5];
int G[25][25];
char kn[6] = "RGBYW";
int kind(char c) {
  for (int i = 0; i < 5; i++)
    if (c == kn[i]) return i;
}
int calc1(int n) {
  int r = 0;
  while (n) {
    r += n % 2;
    n /= 2;
  }
  return r;
}
int vv1[5], vv2[5];
int main() {
  ios::sync_with_stdio(false);
  int n;
  char x, y;
  while (cin >> n) {
    memset(vis, 0, sizeof(vis));
    memset(vv1, 0, sizeof(vv1));
    memset(vv2, 0, sizeof(vv2));
    int c1 = 0, c2 = 0;
    for (int i = 0; i < n; i++) {
      cin >> x >> y;
      if (!vv1[kind(x)]) c1++;
      if (!vv2[y - '1']) c2++;
      vv1[kind(x)]++;
      vv2[y - '1']++;
      vis[kind(x)][y - '1'] = 1;
    }
    int v1[5] = {0};
    int v2[5] = {0};
    int ans = 0x3FFFFFFF;
    for (int v = 0; v < 1 << 10; v++) {
      int n = calc1(v);
      int t = v;
      for (int i = 0; i < 5; i++) {
        v1[i] = t % 2;
        t /= 2;
      }
      for (int i = 0; i < 5; i++) {
        v2[i] = t % 2;
        t /= 2;
      }
      for (int i = 0; i < 25; i++)
        for (int j = 0; j < 25; j++) G[i][j] = G[j][i] = 1;
      int cc1[5] = {0};
      int cc2[5] = {0};
      for (int i = 0; i < 5; i++)
        if (v1[i]) {
          for (int j = 0; j < 5; j++) {
            for (int k = 0; k < 25; k++) {
              if (i != k / 5) {
                G[i * 5 + j][k] = G[k][i * 5 + j] = 0;
              }
            }
          }
        }
      for (int i = 0; i < 5; i++)
        if (v2[i]) {
          for (int j = 0; j < 5; j++) {
            for (int k = 0; k < 25; k++) {
              if (i != k % 5) {
                G[i + j * 5][k] = G[k][i + j * 5] = 0;
              }
            }
          }
        }
      int f = 0;
      for (int i = 0; i < 25; i++)
        if (vis[i / 5][i % 5]) {
          for (int j = 0; j < 25; j++)
            if (vis[j / 5][j % 5] && i != j) {
              if (G[i][j] == 1) f = 1;
            }
        }
      if (!f) ans = min(ans, n);
    }
    cout << ans << endl;
  }
  return 0;
}
