#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > card(6, vector<int>(6));
vector<vector<pair<bool, bool> > > choose(6, vector<pair<bool, bool> >(6));
pair<bool, bool> fclear = make_pair(false, false);
int CtC(char ch) {
  if (ch == 'R') return 1;
  if (ch == 'G') return 2;
  if (ch == 'B') return 3;
  if (ch == 'Y') return 4;
  if (ch == 'W') return 5;
}
void clear(void) {
  for (int i = 1; i < 6; i++)
    for (int j = 1; j < 6; j++) choose[i][j] = fclear;
}
void check(void) {
  bool repeat = false;
  for (int i = 1; i < 6; i++) {
    for (int j = 1; j < 6; j++) {
      if (card[i][j] == 0) continue;
      bool C = choose[i][j].first;
      bool V = choose[i][j].second;
      if (!C) {
        bool flag = true;
        for (int x = 1; x < 6; x++) {
          for (int y = 1; y < 6; y++) {
            if (x == i) break;
            if (card[x][y] == 0) continue;
            if (choose[x][y].first == false) {
              flag = false;
              goto t;
            }
          }
        }
      t:
        if (flag) {
          choose[i][j].first = true;
          repeat = true;
          C = true;
        } else if (V) {
          flag = true;
          for (int x = 1; x < 6; x++) {
            if (x == i) continue;
            if (card[x][j] == 0) continue;
            if (choose[x][j].first == false || choose[x][j].second == false) {
              flag = false;
              break;
            }
          }
          if (flag) {
            choose[i][j].first = true;
            C = true;
            repeat = true;
          }
        }
      }
      if (!V && C) {
        bool flag = true;
        for (int y = 1; y < 6; y++) {
          if (y == j) continue;
          if (card[i][y] == 0) continue;
          if (choose[i][y].first == false || choose[i][y].second == false) {
            flag = false;
            break;
          }
        }
        if (flag) {
          choose[i][j].second = true;
          repeat = true;
        }
      }
    }
  }
  if (repeat) check();
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char color;
    int value;
    cin >> color >> value;
    card[CtC(color)][value]++;
  }
  int ans = 10;
  for (int i = 0; i < 1024; i++) {
    int count = 0;
    int num = i;
    bool bit[10] = {false};
    int ind = 9;
    while (num > 0) {
      bit[ind] = num & 1;
      count += bit[ind];
      num >>= 1;
      ind--;
    }
    for (int j = 0; j < 5; j++) {
      if (bit[j])
        for (int k = 1; k <= 5; k++) choose[j + 1][k].first = true;
    }
    for (int j = 5; j <= 9; j++) {
      if (bit[j])
        for (int k = 1; k <= 5; k++) choose[k][j - 4].second = true;
    }
    check();
    bool f = true;
    for (int x = 1; x < 6; x++) {
      for (int y = 1; y < 6; y++) {
        if (card[x][y] == 0) continue;
        if (!choose[x][y].first || !choose[x][y].second) {
          f = false;
          goto answer;
        }
      }
    }
  answer:
    if (f) ans = min(ans, count);
    clear();
  }
  cout << ans;
  return 0;
}
