#include <bits/stdc++.h>
using namespace std;
const int inf = 2e8 + 5;
const long long l_inf = 9e18 + 5;
template <typename T>
inline T mod(T a, T b) {
  return (a % b + b) % b;
}
template <typename T, typename T2>
ostream &operator<<(ostream &s, const pair<T, T2> &p) {
  return s << p.first << ' ' << p.second << ' ';
}
template <typename T, typename T2>
istream &operator>>(istream &s, pair<T, T2> &p) {
  return s >> p.first >> p.second;
}
template <typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
  for (auto it : v) s << it << ' ';
  return s;
}
template <typename T>
istream &operator>>(istream &s, vector<T> &v) {
  for (auto it = (v).begin(), it_ = (v).end(); it != it_; it++) s >> *it;
  return s;
}
template <typename T>
void read_range(T beg, T end) {
  while (beg != end) cin >> *beg++;
}
template <typename T>
void print_range(T beg, T end) {
  while (beg != end) cout << *beg++ << ' ';
}
struct reader {
  template <typename T>
  reader &operator,(T &v) {
    cin >> v;
    return *this;
  }
} rdr;
struct debugger {
  template <typename T>
  debugger &operator,(const T &v) {
    cerr << v << ", ";
    return *this;
  }
} dbg;
inline int color_i(char c) {
  switch (c) {
    case 'R':
      return 0;
    case 'G':
      return 1;
    case 'B':
      return 2;
    case 'Y':
      return 3;
    default:
      return 4;
  }
}
inline char index_c(int c) {
  switch (c) {
    case 0:
      return 'R';
    case 1:
      return 'G';
    case 2:
      return 'B';
    case 3:
      return 'Y';
    default:
      return 'W';
  }
}
bool have[5][5];
int unknown_color_cnt[5];
int unknown_number_cnt[5];
int color_cnt[5];
int number_cnt[5];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  rdr, n;
  ;
  for (int i = 0, end = (n); i < end; i++) {
    string card;
    rdr, card;
    ;
    have[color_i(card[0])][card[1] - '1'] = true;
  }
  for (int i = 0; i < 5; i++)
    for (int j = 0; j < 5; j++)
      if (have[i][j]) color_cnt[i]++, number_cnt[j]++;
  int min_info = inf;
  for (int i = 0; i < 31; i++)
    for (int j = 0; j < 31; j++) {
      int info_cnt = 0;
      for (int k = 0; k < 5; k++) info_cnt += ((i >> k) & 1) + ((j >> k) & 1);
      int uk_cnt = 0;
      for (int k = 0; k < 5; k++)
        for (int l = 0; l < 5; l++)
          if (have[k][l]) {
            bool know_color = (i >> k) & 1;
            bool know_number = (j >> l) & 1;
            if (know_color and color_cnt[k] == 1) know_number = true;
            if (know_number and number_cnt[l] == 1) know_color = true;
            if (!know_color or !know_number) uk_cnt++;
            if (know_color and !know_number) unknown_color_cnt[k]++;
            if (know_number and !know_color) {
              unknown_number_cnt[l]++;
            }
          }
      uk_cnt--;
      for (int k = 0; k < 5; k++) {
        uk_cnt -= (color_cnt[k] != 1 and unknown_color_cnt[k] == 1) +
                  (number_cnt[k] != 1 and unknown_number_cnt[k] == 1);
      }
      if (uk_cnt <= 0) min_info = min(min_info, info_cnt);
      memset(unknown_color_cnt, 0, sizeof(unknown_color_cnt)),
          memset(unknown_number_cnt, 0, sizeof(unknown_number_cnt));
    }
  cout << min_info;
  return 0;
}
