#include <bits/stdc++.h>
using namespace std;
int countBits(int n) {
  if (n <= 1) return n;
  return countBits(n >> 1) + (n % 2);
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  int all[5][5] = {};
  vector<pair<int, int> > cards;
  for (int i = (0); i < ((n)); ++i) {
    string s;
    cin >> s;
    string const LABELS = "RGBYW";
    int const label = LABELS.find(s[0]);
    int const num = s[1] - '1';
    cards.push_back(make_pair(label, num));
    ++all[label][num];
  }
  int best = 1e9;
  for (int mask1 = (0); mask1 < ((1 << 5)); ++mask1)
    for (int mask2 = (0); mask2 < ((1 << 5)); ++mask2) {
      int const asks = countBits(mask1) + countBits(mask2);
      int colored[5][5] = {};
      int numbered[5][5] = {};
      for (int i = (0); i < ((n)); ++i) {
        if (mask1 & (1 << cards[i].first))
          ++colored[cards[i].first][cards[i].second];
        if (mask2 & (1 << cards[i].second))
          ++numbered[cards[i].first][cards[i].second];
      }
      bool ok = true;
      int done[5][5] = {};
      while (true) {
        int incomplete = 0;
        int wellDone = 0;
        int nonTouch = 0;
        for (int l = (0); l < ((5)); ++l)
          for (int d = (0); d < ((5)); ++d)
            if (all[l][d] && !done[l][d]) {
              if (colored[l][d] && numbered[l][d]) {
                done[l][d] = 1;
                ++wellDone;
                continue;
              }
              int can = 0;
              if (colored[l][d]) {
                for (int digit = (0); digit < ((5)); ++digit)
                  if (all[l][digit] && !done[l][digit]) ++can;
              } else if (numbered[l][d]) {
                for (int label = (0); label < ((5)); ++label)
                  if (all[label][d] && !done[label][d]) ++can;
              } else {
                ++nonTouch;
              }
              if (can == 1) {
                done[l][d] = 1;
                wellDone++;
              } else
                ++incomplete;
            }
        if (nonTouch == 1) {
          --incomplete;
        }
        if (incomplete == 0) {
          ok = true;
          break;
        }
        if (wellDone == 0) {
          ok = incomplete == 0;
          break;
        }
      }
      if (ok) {
        best = min(best, asks);
      }
    }
  cout << best << endl;
  return 0;
}
