#include <bits/stdc++.h>
using namespace std;
template <class T>
T sq(T x) {
  return x * x;
}
const long long inf = 2147383647;
const double pi = 2 * acos(0.0);
const double eps = 1e-9;
const long long maxint = 2147483647;
const long long minint = -2147483648;
vector<pair<int, int> > ball;
map<pair<int, int>, int> mp;
int renum[300];
int arr[5], brr[5];
void precal() {
  renum['R'] = 0;
  renum['G'] = 1;
  renum['B'] = 2;
  renum['Y'] = 3;
  renum['W'] = 4;
}
bool findOrder(int m1, int m2) {
  memset(arr, -1, sizeof arr);
  memset(brr, -1, sizeof brr);
  int i, j;
  int la = -1, lb = -1;
  for (i = 0; i < ball.size(); i++) {
    int a = ball[i].first;
    int b = ball[i].second;
    if ((m1 & (1 << a)) && (m2 & (1 << b))) continue;
    if ((m1 & (1 << a))) {
      if (arr[a] == -1)
        arr[a] = b;
      else if (arr[a] != b)
        return false;
    } else if ((m2 & (1 << b))) {
      if (brr[b] == -1)
        brr[b] = a;
      else if (brr[b] != a)
        return false;
    } else if (la == -1) {
      la = a;
      lb = b;
    } else {
      if (la != a || lb != b) return false;
    }
  }
  return true;
}
int main() {
  precal();
  int n;
  scanf("%d", &n);
  int i;
  for (i = 0; i < n; i++) {
    char c;
    scanf(" %c", &c);
    int t1 = renum[c];
    scanf(" %c", &c);
    int t2 = c - '0' - 1;
    ;
    pair<int, int> temp = make_pair(t1, t2);
    if (mp.find(temp) == mp.end()) {
      mp[temp] = 1;
      ball.push_back(temp);
    }
  }
  int j;
  int res = inf;
  int lim = (1 << 5);
  for (i = 0; i < lim; i++) {
    for (j = 0; j < lim; j++) {
      if (findOrder(i, j)) {
        res = min(res, __builtin_popcount(i) + __builtin_popcount(j));
      }
    }
  }
  printf("%d\n", res);
  return 0;
}
