#include <iostream>
#include <algorithm>
#include <vector>

constexpr int X = 1 << 20;

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> cnt(X + 1, 0);
    cnt[0] = 1;
    int low = 0;
    while (n--) {
        int x;
        std::cin >> x;
        x = std::min(x, X);

        if (x < low) {
            std::cout << "No" << std::endl;
            continue;
        }

        std::cout << "Yes" << std::endl;

        int y = x;
        while (cnt[y] == 0) --y;
        --cnt[y];
        while (y < x) {
            ++y;
            ++cnt[y];
        }

        while (low <= X && cnt[low] == 0) ++low;
    }
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}


### Prompt

Develop a solution in Cpp to the problem described below:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include <iostream>
#include <algorithm>
#include <vector>

constexpr int X = 1 << 20;

void solve() {
    int n;
    std::cin >> n;

    std::vector<int> cnt(X + 1, 0);
    cnt[0] = 1;
    int low = 0;
    while (n--) {
        int x;
        std::cin >> x;
        x = std::min(x, X);

        if (x < low) {
            std::cout << "No" << std::endl;
            continue;
        }

        std::cout << "Yes" << std::endl;

        int y = x;
        while (cnt[y] == 0) --y;
        --cnt[y];
        while (y < x) {
            ++y;
            ++cnt[y];
        }

        while (low <= X && cnt[low] == 0) ++low;
    }
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}


```