#include <bits/stdc++.h>   using namespace std;   char op[] = { R ,  G ,  B ,  Y ,  W ,  1 ,  2 ,  3 ,  4 ,  5 };   string s[555];   int main() {     int n, i, j, k;     ios_base::sync_with_stdio(0), cin.tie(0);     cin >> n;     for (i = 1; i <= n; i++) {       cin >> s[i];     }     map<char, bool> mp;     int mn = 100000;     for (int msk = 0; msk < (1024); msk++) {       mp.clear();       for (i = 0; i < 10; i++) {         if (msk & (1 << i)) {           mp[op[i]] = 1;         }       }       bool f = 1;       for (i = 1; i <= n; i++) {         for (j = i + 1; j <= n; j++) {           if (s[i] == s[j]) continue;           if (s[i][0] == s[j][0]) {             if (!mp[s[i][1]] && !mp[s[j][1]]) {               f = 0;               break;             }           } else if (s[i][1] == s[j][1]) {             if (!mp[s[i][0]] && !mp[s[j][0]]) {               f = 0;               break;             }           } else {             if (!mp[s[i][1]] && !mp[s[j][1]] && !mp[s[i][0]] && !mp[s[j][0]]) {               f = 0;               break;             }           }         }         if (!f) break;       }       if (f == 1) mn = min(mn, __builtin_popcount(msk));     }     cout << mn << endl;   }   