[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
new static double constant EPS = 1e-5
new chat array colortable with elements 'R', 'G', 'B', 'Y' and 'W'
int function getX with string argument s
    for i from 0 to 5 exclusive incrementing i
        if colortable[i] is equal to s[0], return i
    end of the block
    return -1
end of the block
getY is a integer function with string argument s
    return s[1] - '1'
end of the block
bitcount is a int function with int argument b
    declare new integer variable ans = 0
    while b != 0
        increment ans
        change b to b & (b - 1)
    end of the block
    return ans
end of the block
bool function check with int arguments maskX and maskY and string arguments C1 and C2
    x1 is a new integer = result of getX(C1)
    create new integer variable x2 with value from getX(C2)
    declare integer variable y1 = value, returned by getY(C1)
    declare integer y2 = result of getY(C2)
    return true if x1 is equal to x2 and y1 = y2
    if x1 != x2
        if (maskX & (1 << x1)) != 0 || (maskX & (1 << x2)) != 0, return true
    end of the block
    if y1 != y2
        if (maskY & (1 << y1)) != 0 || (maskY & (1 << y2)) != 0, return true
    end of the block
    return false
end of the block
define the main function
    declare new integer variable n
    read n
    cards is a new vector of strings with n elements
    read n elements from the input into cards in a loop
    declare new integer ans = 100000
    sort cards
    remove duplicates from cards
    start for loop from maskX = 0 to 1 << 5 exclusive
        start for loop from maskY = 0 to 1 << 5 exclusive incrementing maskY
            create boolean variable with name ok = true
            incremen i in a loop from 0, while ok is true and i < size of cards
                for j from i + 1 to exclusive, assign the result of check(maskX, maskY, cards[i], cards[j]) to ok
            end of the block
            if ok is true, set the value of ans to min of ans and bitcount(maskX) + bitcount(maskY)
        end of the block
    end of the block
    print ans to the standard output
    return to indicate successful execution
end of the block

[CODE]:

static const double EPS = 1e-5;
char colortable[] = {'R', 'G', 'B', 'Y', 'W'};
int getX(string s) {
    for (int i = 0; i < 5; i++) {
        if (colortable[i] == s[0]) return i;
    }
    return -1;
}
int getY(string s) {
    return s[1] - '1';
}
int bitcount(int b) {
    int ans = 0;
    while (b != 0) {
        ans++;
        b &= b - 1;
    }
    return ans;
}
bool check(int maskX, int maskY, string C1, string C2) {
    int x1 = getX(C1);
    int x2 = getX(C2);
    int y1 = getY(C1);
    int y2 = getY(C2);
    if (x1 == x2 && y1 == y2) return true;
    if (x1 != x2) {
        if ((maskX & (1 << x1)) != 0 || (maskX & (1 << x2)) != 0) return true;
    }
    if (y1 != y2) {
        if ((maskY & (1 << y1)) != 0 || (maskY & (1 << y2)) != 0) return true;
    }
    return false;
}
int main() {
    int n;
    cin >> n;
    vector<string> cards(n);
    for (int i = 0; i < n; i++) cin >> cards[i];
    int ans = 100000;
    sort(cards.begin(), cards.end());
    cards.erase(unique(cards.begin(), cards.end()), cards.end());
    for (int maskX = 0; maskX < (1 << 5); maskX++) {
        for (int maskY = 0; maskY < (1 << 5); maskY++) {
            bool ok = true;
            for (int i = 0; ok && (i < (int)cards.size()); i++) {
                for (int j = i + 1; ok && (j < (int)cards.size()); j++) { ok = check(maskX, maskY, cards[i], cards[j]); }
            }
            if (ok) { ans = min(ans, bitcount(maskX) + bitcount(maskY)); }
        }
    }
    cout << ans << endl;
    return 0;
}