[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]:
make int arrays a of size 1000 and b of size 1000
create char C of size 1000
declare B taking in integer x and returning integer
    create int ans = 0
    for i = 0 to 10 exclusive
        if (1 << i) & x is truthy, increment ans
    return ans
end of the block
define the main function
    create integer n
    read n
    for i = 0 to n exclusive
        read C[i] and a[i]
        decrease a[i] by 1
        if C[i] is equal to 'R', set b[i] to 0
        if C[i] is equal to 'Y', set b[i] to 1
        if C[i] is equal to 'W', set b[i] to 2
        if C[i] is equal to 'G', set b[i] to 3
        if C[i] is equal to 'B', set b[i] to 4
    end of the block
    make integer ans = n + 1
    for i = 0 to 32 exclusive
        for j = 0 to 32 exclusive
            make int arrays f of size 5 and g of size 5
            for k = 0 to 5 exclusive
                if (1 << k) & 1 is truthy
                    set f[k] to 1
                else do
                    set f[k] to 0
            for k = 0 to 5 exclusive
                if (1 << k) & j is truthy
                    set g[k] to 1
                otherwise
                    set g[k] to 0
            create integer f1 = 1
            for i = 0 to n exclusive
                for j = i + 1 to n exclusive
                    if a[i] is equal to a[j] and b[i] is equal to b[i], continue loop
                    if a[i] is equal to a[j] and g[b[i]] | g[b[j]] is truthy, continue to next loop iteration
                    if b[i] is equal to b[j] and f[a[i]] | f[a[j]] is truthy, continue loop
                    if a[i] is not equal to a[j] and b[i] is not equal to b[j] and f[a[i]] | f[a[j]] | g[b[i]] | g[b[j]] is truthy, continue loop
                    set f1 to 0
                end of the block
            if f1 is truthy, set ans to min of ans and B(i) + B(j)
        end of the block
    end of the block
    show ans
end of the block

[CODE]:

int a[1000], b[1000];
char C[1000];
int B(int x) {
    int ans = 0;
    for (int i = 0; i < 10; i++)
        if ((1 << i) & x) ans++;
    return ans;
}
int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> C[i] >> a[i];
        a[i]--;
        if (C[i] == 'R') b[i] = 0;
        if (C[i] == 'Y') b[i] = 1;
        if (C[i] == 'W') b[i] = 2;
        if (C[i] == 'G') b[i] = 3;
        if (C[i] == 'B') b[i] = 4;
    }
    int ans = n + 1;
    for (int i = 0; i < 32; i++) {
        for (int j = 0; j < 32; j++) {
            int f[5], g[5];
            for (int k = 0; k < 5; k++)
                if ((1 << k) & i)
                    f[k] = 1;
                else
                    f[k] = 0;
            for (int k = 0; k < 5; k++)
                if ((1 << k) & j)
                    g[k] = 1;
                else
                    g[k] = 0;
            int fl = 1;
            for (int i = 0; i < n; i++)
                for (int j = i + 1; j < n; j++) {
                    if (a[i] == a[j] && b[i] == b[j]) continue;
                    if (a[i] == a[j] && g[b[i]] | g[b[j]]) continue;
                    if (b[i] == b[j] && f[a[i]] | f[a[j]]) continue;
                    if (a[i] != a[j] && b[i] != b[j] && f[a[i]] | f[a[j]] | g[b[i]] | g[b[j]]) continue;
                    fl = 0;
                }
            if (fl) ans = min(ans, B(i) + B(j));
        }
    }
    cout << ans << endl;
}