#include <bits/stdc++.h>
using namespace std;
const int N = 300;
int n;
pair<int, int> p[N];
bool s[100][100];
bool bit(int mask, int x) { return (mask & x); }
int main() {
  scanf("%d\n", &n);
  for (int i = 1; i <= n; i++) {
    char ch;
    int x1, x2;
    scanf("%c%d ", &ch, &x2);
    if (ch == 'R')
      x1 = 1;
    else if (ch == 'G')
      x1 = 2;
    else if (ch == 'B')
      x1 = 3;
    else if (ch == 'Y')
      x1 = 4;
    else
      x1 = 5;
    x1--;
    x2--;
    p[i] = make_pair(x1, x2);
  }
  int ans = 10000;
  for (int mask1 = 0; mask1 <= (1 << 5) - 1; mask1++)
    for (int mask2 = 0; mask2 <= (1 << 5) - 1; mask2++) {
      bool f = true;
      for (int i = 1; i <= n; i++)
        for (int j = 1; j <= n; j++)
          if (p[i] != p[j]) {
            if (p[i].first == p[j].first) {
              if ((!bit(mask2, 1 << p[i].second)) &&
                  (!bit(mask2, 1 << p[j].second)))
                f = false;
            } else if (p[i].second == p[j].second) {
              if ((!bit(mask1, 1 << p[i].first)) &&
                  (!bit(mask1, 1 << p[j].first)))
                f = false;
            } else {
              bool f1 = true;
              bool f2 = true;
              if ((!bit(mask2, 1 << p[i].second)) &&
                  (!bit(mask2, 1 << p[j].second)))
                f1 = false;
              if ((!bit(mask1, 1 << p[i].first)) &&
                  (!bit(mask1, 1 << p[j].first)))
                f2 = false;
              if (!f1 && !f2) f = false;
            }
          }
      if (f) {
        int k1 = 0;
        for (int j = 0; j <= 4; j++)
          if (mask1 & (1 << j)) k1++;
        int k2 = 0;
        for (int j = 0; j <= 4; j++)
          if (mask2 & (1 << j)) k2++;
        ans = min(ans, k1 + k2);
      }
    }
  cout << ans;
  return 0;
}
