#include <bits/stdc++.h>
using namespace std;
vector<pair<char, int> > vec(100);
int n;
bool check(vector<bool> &bitmask) {
  bool flag = 1;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (vec[i].first == vec[j].first) {
        if (vec[i].second != vec[j].second) {
          if (bitmask[vec[i].second - 1] == 1 ||
              bitmask[vec[j].second - 1] == 1) {
            continue;
          } else {
            flag = 0;
            return flag;
          }
        } else {
          continue;
        }
      } else {
        if (vec[i].second == vec[j].second) {
          if ((vec[i].first == 'R' || vec[j].first == 'R') && bitmask[5] == 1) {
            continue;
          } else if ((vec[i].first == 'G' || vec[j].first == 'G') &&
                     bitmask[6] == 1) {
            continue;
          } else if ((vec[i].first == 'B' || vec[j].first == 'B') &&
                     bitmask[7] == 1) {
            continue;
          } else if ((vec[i].first == 'Y' || vec[j].first == 'Y') &&
                     bitmask[8] == 1) {
            continue;
          } else if ((vec[i].first == 'W' || vec[j].first == 'W') &&
                     bitmask[9] == 1) {
            continue;
          } else {
            flag = 0;
            return flag;
          }
        } else {
          if ((vec[i].first == 'R' || vec[j].first == 'R') && bitmask[5] == 1) {
            continue;
          } else if ((vec[i].first == 'G' || vec[j].first == 'G') &&
                     bitmask[6] == 1) {
            continue;
          } else if ((vec[i].first == 'B' || vec[j].first == 'B') &&
                     bitmask[7] == 1) {
            continue;
          } else if ((vec[i].first == 'Y' || vec[j].first == 'Y') &&
                     bitmask[8] == 1) {
            continue;
          } else if ((vec[i].first == 'W' || vec[j].first == 'W') &&
                     bitmask[9] == 1) {
            continue;
          } else if (bitmask[vec[i].second - 1] == 1 ||
                     bitmask[vec[j].second - 1] == 1) {
            continue;
          } else {
            flag = 0;
            return flag;
          }
        }
      }
    }
  }
  return flag;
}
int solve() {
  vector<bool> counter(10, 0);
  int ans = 100;
  while (1) {
    if (check(counter)) {
      int cnt = 0;
      for (int i = 0; i < 10; i++) {
        if (counter[i] == 1) {
          cnt++;
        }
      }
      ans = min(ans, cnt);
    }
    int i = 0;
    while (i < 10 && counter[i] == 1) counter[i++] = 0;
    if (i == 10) break;
    counter[i] = 1;
  }
  return ans;
}
int main() {
  int t = 1;
  while (t--) {
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> vec[i].first >> vec[i].second;
    }
    int ans = solve();
    cout << ans << "\n";
  }
  return 0;
}
