#include <bits/stdc++.h>
using namespace std;
bool exty[25];
int n;
int bit_count(unsigned n) {
  int sum = 0;
  while (n) {
    n &= (n - 1);
    sum++;
  }
  return sum;
}
bool check(unsigned x, unsigned y) {
  bool _exty[25];
  for (int i = 0; i < 25; i++) _exty[i] = exty[i];
  int rest = 0;
  for (int i = 0; i < 25; i++)
    if (exty[i]) rest++;
  for (int i = 0; i <= 4; i++)
    for (int j = 0; j <= 4; j++)
      if ((x & (1 << i)) && (y & (1 << j)) && (exty[i * 5 + j])) {
        exty[i * 5 + j] = false;
        rest--;
      }
  if (rest <= 1) {
    for (int i = 0; i < 25; i++) exty[i] = _exty[i];
    return true;
  }
  int rest0 = -1;
  while (rest0 != rest) {
    rest0 = rest;
    for (int i = 0; i <= 4; i++)
      if (x & (1 << i)) {
        int times = 0;
        for (int j = 0; j <= 4; j++)
          if (exty[i * 5 + j]) times++;
        if (times == 1)
          for (int j = 0; j <= 4; j++)
            if (exty[i * 5 + j]) {
              exty[i * 5 + j] = false;
              rest--;
            }
      }
    for (int i = 0; i <= 4; i++)
      if (y & (1 << i)) {
        int times = 0;
        for (int j = 0; j <= 4; j++)
          if (exty[j * 5 + i]) times++;
        if (times == 1)
          for (int j = 0; j <= 4; j++)
            if (exty[j * 5 + i]) {
              exty[j * 5 + i] = false;
              rest--;
            }
      }
  }
  for (int i = 0; i < 25; i++) exty[i] = _exty[i];
  if (rest <= 1) return true;
  return false;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    char x1;
    int y;
    cin >> x1 >> y;
    int x;
    switch (x1) {
      case 'R':
        x = 0;
        break;
      case 'G':
        x = 1;
        break;
      case 'B':
        x = 2;
        break;
      case 'Y':
        x = 3;
        break;
      default:
        x = 4;
    }
    exty[x * 5 + y - 1] = true;
  }
  int ans = 10;
  for (unsigned i = 0; i < 32; i++)
    for (unsigned j = 0; j < 32; j++)
      if (check(i, j)) ans = min(ans, bit_count(i) + bit_count(j));
  cout << ans << endl;
  return 0;
}
