#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  if (n == 1) {
    cout << 0;
    return 0;
  }
  vector<vector<bool> > T(5);
  for (int i = (0); i <= ((int)(T).size() - 1); ++i) T[i].resize(5, 0);
  for (int i = (1); i <= (n); ++i) {
    string s;
    cin >> s;
    int x, y;
    switch (s[0]) {
      case 'R':
        x = 0;
        break;
      case 'G':
        x = 1;
        break;
      case 'B':
        x = 2;
        break;
      case 'Y':
        x = 3;
        break;
      case 'W':
        x = 4;
        break;
    }
    y = (int)(s[1] - '1');
    T[x][y] = 1;
  }
  int ans = 1000000001;
  for (int i = (0); i <= (31); ++i)
    for (int j = (0); j <= (31); ++j) {
      vector<bool> X, Y;
      int I = i, J = j;
      while (I > 0) {
        X.push_back(I % 2);
        I >>= 1;
      }
      while (J > 0) {
        Y.push_back(J % 2);
        J >>= 1;
      }
      while ((int)(X).size() < 5) X.push_back(0);
      while ((int)(Y).size() < 5) Y.push_back(0);
      int cnt;
      bool good = 1;
      for (int x = (0); x <= (4); ++x) {
        cnt = 0;
        for (int y = (0); y <= (4); ++y)
          if (T[x][y] && !Y[y]) cnt++;
        if (cnt > 1) good = 0;
      }
      for (int y = (0); y <= (4); ++y) {
        cnt = 0;
        for (int x = (0); x <= (4); ++x)
          if (T[x][y] && !X[x]) cnt++;
        if (cnt > 1) good = 0;
      }
      int bad = 0;
      for (int x = (0); x <= (4); ++x)
        for (int y = (0); y <= (4); ++y)
          if (T[x][y]) {
            if (!X[x] && !Y[y]) bad++;
          }
      if (bad > 1) good = 0;
      if (good) {
        int q = 0;
        for (int k = (0); k <= ((int)(X).size() - 1); ++k) q += X[k];
        for (int k = (0); k <= ((int)(Y).size() - 1); ++k) q += Y[k];
        ans = (((ans) < (q)) ? (ans) : (q));
      }
    }
  cout << ans;
  return 0;
}
