[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]:
create ints ans and n and int array b of size 20
make bool array a of size 10 with array of size 10
declare check returning bool
    make ints i, j, r, l, and tot
    for i = 1 to 5
        set l and r to 0
        for j = 1 to 5
            if a[i][j] is truthy
                increment l
                if b[j] is truthy, add 1 to r
            end of the block
        end of the block
        if l - 1 is greater than r, return false
    end of the block
    for i = 1 to 5
        set l and r to 0
        for j = 1 to 5
            if a[j][i] is truthy
                increment l
                if b[5 + j] is truthy, increment r
            end of the block
        end of the block
        if l - 1 is greater than r, return false
    end of the block
    set tot to 0
    for i = 1 to 5
        for j = 1 to 5
            if a[i][j] is truthy, !b[i + 5] is truthy, and b[j] is falsy, increment tot
        end of the block
    end of the block
    if tot is greater than 1, return false
    return true
end of the block
declare dfs taking in integer x
    make ints i and sum
    if x is equal to 11
        if check() returns true
            set sum to 0
            for i = 1 to 11
                if b[i] is equal to 1, add 1 to sum
            end of the block
            set ans to min of sum and ans
        end of the block
        return
    end of the block
    set b[x] to 1
    call dfs(x + 1)
    set b[x] to 0
    call dfs(x + 1)
end of the block
define the main function
    create ints i and y
    make char ch
    let integer k
    read n
    set all contents of a to false
    for i = 1 to n
        read ch and k
        if ch is equal to 'R'
            set y to 1
        else if ch is equal to 'G'
            set y to 2
        else if ch is equal to 'B'
            set y to 3
        else if ch is equal to 'Y'
            set y to 4
        else if ch is equal to 'W'
            set y to 5
        set a[y][k] to true
    end of the block
    set all contents of b to 0
    set ans to 9999999
    end statement
    call dfs(1)
    show ans
end of the block

[CODE]:

int b[20], ans, n;
bool a[10][10];
bool check() {
    int i, j, r, l, tot;
    for (i = 1; i <= 5; i++) {
        l = r = 0;
        for (j = 1; j <= 5; j++) {
            if (a[i][j]) {
                l++;
                if (b[j]) { r++; }
            }
        }
        if (l - 1 > r) return false;
    }
    for (i = 1; i <= 5; i++) {
        l = r = 0;
        for (j = 1; j <= 5; j++) {
            if (a[j][i]) {
                l++;
                if (b[5 + j]) r++;
            }
        }
        if (l - 1 > r) return false;
    }
    tot = 0;
    for (i = 1; i <= 5; i++) {
        for (j = 1; j <= 5; j++) {
            if (a[i][j] && !b[i + 5] && !b[j]) tot++;
        }
    }
    if (tot > 1) return false;
    return true;
}
void dfs(int x) {
    int i, sum;
    if (x == 11) {
        if (check()) {
            sum = 0;
            for (i = 1; i <= 11; i++) {
                if (b[i] == 1) sum++;
            }
            ans = min(sum, ans);
        }
        return;
    }
    b[x] = 1;
    dfs(x + 1);
    b[x] = 0;
    dfs(x + 1);
}
int main() {
    int i, y;
    char ch;
    int k;
    cin >> n;
    memset(a, false, sizeof(a));
    for (i = 1; i <= n; i++) {
        cin >> ch >> k;
        if (ch == 'R')
            y = 1;
        else if (ch == 'G')
            y = 2;
        else if (ch == 'B')
            y = 3;
        else if (ch == 'Y')
            y = 4;
        else if (ch == 'W')
            y = 5;
        a[y][k] = true;
    }
    memset(b, 0, sizeof(b));
    ans = 9999999;
    ;
    dfs(1);
    cout << ans << endl;
}