[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 the main function
    n = integer
    read n
    C = boolean array of sizes 5, 5 with C = {}
    color = string = "RGBYW"
    value = string = "12345"
    for i = 0 to n exclusive
        declare a string c
        read c
        for i = 0 to 5 exclusive
            for j = 0 to 5 exclusive
                if c[0] equals color[i] and c[1] equals value[j], set C[i][j] to true
    end of the block
    ans = integer set to 25
    for bc = 0 as long as bc is less than 1 shifted left 5 bits with increment bc + 1
        for bv = 0 as long as bv is less than 1 shifted left 5 bits with increment bv + 1
            ok = boolean = true
            for c = 0 to 5 exclusive
                if bc shifted left c bitwise and 1 bits
                    t = integer = 0
                    for v = 0 to 5 exclusive
                        if bv shifted right v bitwise and 1 bits is false, add integer value of C[c][v] to t
                    if t is greater than 1, set ok to false
                end of the block
            for v = 0 to 5 exclusive
                if bv shifted right v bitwise and 1 bits
                    t = integer = 0
                    for c = 0 to 5 exclusive
                        if bc shifted right c bitwise and 1 bits is false, add integer value of C[c][v] to t
                    if t is greater than 1, set ok to false
                end of the block
            t = integer = 0
            for c = 0 to 5 exclusive
                for v = 0 to 5 exclusive
                    if not (bc shifted right c bitwise and 1 bits) and not (bv shifted right v bitwise and 1 bits), add integer value of C[c][v] to t
            if t is greater than 1, set ok to false
            if ok
                a = integer set to 0
                for i = 0 to 5 exclusive, add (bc shifted right i bitwise and 1 bits) + (bv shifted right i bitwise and 1 bits) to a
                set ans to call min with ans, a
            end of the block
        end of the block
    display ans
end of the block

[CODE]:

int main() {
    int n;
    cin >> n;
    bool C[5][5] = {};
    string color = "RGBYW";
    string value = "12345";
    for (int i = 0; i < n; i++) {
        string c;
        cin >> c;
        for (int i = 0; i < 5; i++)
            for (int j = 0; j < 5; j++)
                if (c[0] == color[i] && c[1] == value[j]) C[i][j] = true;
    }
    int ans = 25;
    for (int bc = 0; bc < 1 << 5; bc++)
        for (int bv = 0; bv < 1 << 5; bv++) {
            bool ok = true;
            for (int c = 0; c < 5; c++)
                if (bc >> c & 1) {
                    int t = 0;
                    for (int v = 0; v < 5; v++)
                        if (!(bv >> v & 1)) t += (int)C[c][v];
                    if (t > 1) ok = false;
                }
            for (int v = 0; v < 5; v++)
                if (bv >> v & 1) {
                    int t = 0;
                    for (int c = 0; c < 5; c++)
                        if (!(bc >> c & 1)) t += (int)C[c][v];
                    if (t > 1) ok = false;
                }
            int t = 0;
            for (int c = 0; c < 5; c++)
                for (int v = 0; v < 5; v++)
                    if (!(bc >> c & 1) && !(bv >> v & 1)) t += (int)C[c][v];
            if (t > 1) ok = false;
            if (ok) {
                int a = 0;
                for (int i = 0; i < 5; i++) a += (bc >> i & 1) + (bv >> i & 1);
                ans = min(ans, a);
            }
        }
    cout << ans << endl;
}