#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = acos(-1);
template <class T>
T sqr(T x) {
  return x * x;
}
template <class T>
T abs(T x) {
  return x < 0 ? -x : x;
}
const int MAXN = 120;
const int k = 5;
char c[5] = {'R', 'G', 'B', 'Y', 'W'};
int a[k + 5][k + 5];
bool row[k + 5], col[k + 5];
int main() {
  int n;
  cin >> n;
  string s;
  for (int i = 0; i < n; ++i) {
    cin >> s;
    int ind = 0;
    while (c[ind] != s[0]) ind++;
    a[ind][s[1] - '1'] = 1;
  }
  int ans = 2 * k;
  for (int mask = 0; mask < (1 << (2 * k)); ++mask) {
    for (int i = 0; i < k; ++i) {
      row[i] = false;
      col[i] = false;
    }
    int cur = 0;
    for (int i = 0; i < 2 * k; ++i) {
      if (((mask >> i) & 1) != 0) {
        cur++;
        if (i < k) {
          row[i] = true;
        } else {
          col[i - k] = true;
        }
      }
    }
    bool key = true;
    for (int i = 0; i < k; ++i) {
      if (row[i]) {
        int num = 0;
        for (int j = 0; j < k; ++j) {
          if (!col[j]) {
            num += a[i][j];
          }
        }
        if (num > 1) {
          key = false;
          break;
        }
      }
    }
    if (!key) {
      continue;
    }
    for (int i = 0; i < k; ++i) {
      if (col[i]) {
        int num = 0;
        for (int j = 0; j < k; ++j) {
          if (!row[j]) {
            num += a[j][i];
          }
        }
        if (num > 1) {
          key = false;
          break;
        }
      }
    }
    if (!key) {
      continue;
    }
    int total_num = 0;
    for (int i = 0; i < k; ++i) {
      for (int j = 0; j < k; ++j) {
        if (!row[i] && !col[j]) {
          total_num += a[i][j];
        }
      }
    }
    if (total_num > 1) {
      continue;
    }
    ans = min(ans, cur);
  }
  cout << ans << endl;
  return 0;
}
