[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]:
define arrays of shorts X and Y with size 105
bin is a new array of shorts with size 15
create constant integer variable C with value 5
create a map from characters to integers called M
void function trans with int argument x
    create new integer variable ind with value 0
    set first 12 elements of bin to 0
    while x > 0
        change the value of bin[ind] to x modulo 2 and increment ind
        change the value of s quared divided by 2
    end of the block
end of the block
define the main function
    create new character called ch
    define new integer n
    read n from the user input
    assign 0 to M['R']
    assign 1 to M['G']
    change the value of M['B'] to 2
    assign 3 to M['Y']
    assign the new value = 4 to M['W']
    for i = 0 to n exclusive
        read standard input to ch
        change the value of X[i] to M[ch]
        read ch
        assign the new value = ch - '1' to Y[i]
    end of the block
    define integers ans and anst with ans = 20
    declare boolean variable all
    new boolean ones = true
    start for loop from i = 0 to n - 1 exclusive, change ones to (X[i] == X[i + 1] && Y[i] == Y[i + 1]) && ones
    if ones is false
        for integer i = 1 to 1023 inclusive incrementing i
            call trans of i
            change the value of anst to 0
            assign the new value = true to all
            increment k in a loop from 0 to n - 1 exclusive
                for integer l = k + 1 to n exclusive
                    if X[k] != X[l] and (bin[X[k]] or bin[X[l]] = 1)
                        change the value of all to true
                    else if Y[k] != Y[l] and (bin[Y[k] + C] or bin[Y[l] + C] = 1)
                        change the value of all to true
                    else if X[l] = X[k] and Y[l] = Y[k]
                        assign true to all
                    else
                        assign false to all
                    if all is false, break
                end of the block
                if all is false, break the loop
            end of the block
            if all is true
                for i = 0 to 12 exclusive
                    if bin[i] is equal to 1, increment anst by one
                change the value of ans to anst of ans > anst
            end of the block
        end of the block
    else
        print 0
    if ones is false, print ans
    return to indicate successful execution
end of the block

[CODE]:

short X[105], Y[105];
short bin[15];
const int C = 5;
map<char, int> M;
void trans(int x) {
    int ind = 0;
    for (int j = 0; j < 12; j++) bin[j] = 0;
    while (x > 0) {
        bin[ind++] = x % 2;
        x /= 2;
    }
}
int main() {
    char ch;
    int n;
    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 >> ch;
        X[i] = M[ch];
        cin >> ch;
        Y[i] = ch - '1';
    }
    int ans = 20, anst;
    bool all;
    bool ones = true;
    for (int i = 0; i < n - 1; i++) ones = (X[i] == X[i + 1] && Y[i] == Y[i + 1]) && ones;
    if (!ones) {
        for (int i = 1; i <= 1023; i++) {
            trans(i);
            anst = 0;
            all = true;
            for (int k = 0; k < n - 1; k++) {
                for (int l = k + 1; l < n; l++) {
                    if (X[k] != X[l] && ((bin[X[k]] == 1) || (bin[X[l]] == 1)))
                        all = true;
                    else if (Y[k] != Y[l] && ((bin[Y[k] + C] == 1) || bin[Y[l] + C] == 1))
                        all = true;
                    else if (X[l] == X[k] && Y[l] == Y[k])
                        all = true;
                    else
                        all = false;
                    if (!all) break;
                }
                if (!all) break;
            }
            if (all) {
                for (int i = 0; i < 12; i++)
                    if (bin[i] == 1) anst++;
                ans = ans > anst ? anst : ans;
            }
        }
    } else
        cout << 0 << endl;
    if (!ones) cout << ans << endl;
    return 0;
}