#include <bits/stdc++.h>
using namespace std;
int N;
string s;
map<char, int> m;
int card[5][5];
int color[5];
int number[5];
int val[5][5];
void resetVal();
void setValRow(int i);
void setValCol(int j);
bool check();
int main() {
  cin >> N;
  m['R'] = 0;
  m['G'] = 1;
  m['B'] = 2;
  m['Y'] = 3;
  m['W'] = 4;
  for (int i = 0; i < N; i++) {
    cin >> s;
    card[m[s[0]]][s[1] - '1']++;
    color[m[s[0]]]++;
    number[s[1] - '1']++;
  }
  int mSum = 8;
  int num = 1 << 10;
  for (int i = 0; i < num; i++) {
    resetVal();
    for (int j = 0; j < 10; j++) {
      if (i & (1 << j)) {
        if (j < 5) {
          setValRow(j);
        } else {
          setValCol(j - 5);
        }
      }
    }
    if (i == (1 << 0 | 1 << 1 | 1 << 2 | 1 << 3)) {
    }
    if (check()) {
      mSum = min(mSum, __builtin_popcount(i));
    }
  }
  cout << mSum << endl;
  return 0;
}
void resetVal() {
  for (int i = 0; i < 5; i++) {
    for (int j = 0; j < 5; j++) {
      val[i][j] = 0;
    }
  }
}
void setValRow(int i) {
  for (int j = 0; j < 5; j++) {
    val[i][j]++;
  }
}
void setValCol(int j) {
  for (int i = 0; i < 5; i++) {
    val[i][j] += 10;
  }
}
bool check() {
  int noneSum = 0;
  for (int i = 0; i < 5; i++) {
    int colorSum = 0, numberSum = 0;
    for (int j = 0; j < 5; j++) {
      if (card[i][j] && val[i][j] < 10) {
        colorSum++;
      }
      if (card[j][i] && val[j][i] % 2 == 0) {
        numberSum++;
      }
      if (card[i][j] && val[i][j] == 0) {
        noneSum++;
      }
    }
    if (colorSum > 1 || numberSum > 1) {
      return false;
    }
  }
  if (noneSum > 1) {
    return false;
  }
  return true;
}
