#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> arr[200];
int val[200], s[10][10];
int bitsay(int x) {
  int r = 0;
  while (x) {
    r += x & 1;
    x /= 2;
  }
  return r;
}
int ctrl(int mask1, int mask2) {
  int h[200][3] = {0};
  int temp[10][10] = {0}, t[10][3] = {0};
  for (long long int i = 0; i <= 5; i++)
    for (long long int j = 0; j <= 5; j++) temp[i][j] = s[i][j];
  int say = 0;
  for (long long int i = 1; i <= n; i++) {
    if (mask1 & (1 << arr[i].first)) h[i][1] = 1;
    if (mask2 & (1 << arr[i].second)) h[i][2] = 1;
    if (h[i][1] and h[i][2])
      ;
    else if (h[i][1])
      t[arr[i].first][1]++;
    else if (h[i][2])
      t[arr[i].second][2]++;
    else
      say++;
  }
  for (long long int iteration = 1; iteration <= n; iteration++) {
    for (long long int i = 1; i <= n; i++) {
      if (h[i][1] and h[i][2])
        continue;
      else if (h[i][1]) {
        if (t[arr[i].first][1] != 1) continue;
        h[i][2] = 1;
        t[arr[i].first][1]--;
      } else if (h[i][2]) {
        if (t[arr[i].second][2] != 1) continue;
        h[i][1] = 1;
        t[arr[i].second][2]--;
      } else {
        if (say == 1) {
          h[i][1] = h[i][2] = 1;
          t[arr[i].first][1]--;
          t[arr[i].second][2]--;
          say--;
        }
      }
    }
  }
  for (long long int i = 1; i <= n; i++)
    if (!h[i][1] or !h[i][2]) return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  val['R'] = 0;
  val['G'] = 1;
  val['B'] = 2;
  val['Y'] = 3;
  val['W'] = 4;
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    int x;
    char c;
    cin >> c >> x;
    arr[i] = make_pair(val[c], x - 1);
  }
  sort(arr + 1, arr + n + 1);
  n = unique(arr + 1, arr + n + 1) - arr - 1;
  for (long long int i = 1; i <= n; i++) s[arr[i].first][arr[i].second]++;
  int res = 10;
  for (long long int mask1 = 0; mask1 <= 31; mask1++)
    for (long long int mask2 = 0; mask2 <= 31; mask2++)
      if (ctrl(mask1, mask2)) res = min(res, bitsay(mask1) + bitsay(mask2));
  cout << res << endl;
}
