[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]:
ans, n = int and b = int array of size 20
a = two dimensional bool array of sizes 10 and 10
in function check returning bool
    i, j, r, l, tot = int
    for i = 1 to 5 inclusive
        set l and r to 0
        for j = 1 to 5 inclusive
            if a[i][j]
                increment l
                if b[j] increment r
            end of the block
        end of the block
        if l - 1 > r return false
    end of the block
    for i = 1 to 5 inclusive
        set l and r to 0
        for j = 1 to 5 inclusive
            if a[i][j]
                increment l
                if b[5 + j] increment r
            end of the block
        end of the block
        if l - 1 > r return false
    end of the block
    set tot to 0
    for i = 1 to 5 inclusive
        for j = 1 to 5 inclusive
            if a[i][j] and not b[i + 5] and not b[j] increment tot
        end of the block
    end of the block
    if tot > 1 return false
    return true
end of the block
in function dfs taking int x
    i, sum = int
    if x is 11
        if check
            set sum to 0
            for i = 1 to 11 inclusive
                if b[i] is 1 increment sum
            end of the block
            set ans to min of sum, ans
        end of the block
        return
    end of the block
    set b[x] to 1
    call dfs of x + 1
    set b[x] to 0
    call dfs of x + 1
end of the block
define the main function
    i, y = int
    ch = char
    k = int
    read n
    set all values of a to false
    for i = 1 to n inclusive
        read ch then k
        if ch is 'R'
            set y to 1
        else if ch is 'G'
            set y to 2
        else if ch is 'B'
            set y to 3
        else if ch is 'Y'
            set y to 4
        else if ch is 'W'
            set y to 5
        set a[y][k] to true
    end of the block
    set all values of b to 0
    set ans to 9999999
    noop
    call dfs of 1
    print 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;
}