#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,x,y=1;
    unordered_set<int>s;
    cin>>n;
    while(n--){
        scanf("%d",&x);
        while(s.count(y))y++;
        if(s.count(0)||x<y-1||(x==y-1&&s.size()>y-1)){
            cout<<"No"<<endl;
            continue;
        }
        cout<<"Yes"<<endl;
        while(s.count(x)) s.erase(x--);
        s.insert(x);
    }
}

### Prompt

Generate a Cpp solution to the following problem:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,x,y=1;
    unordered_set<int>s;
    cin>>n;
    while(n--){
        scanf("%d",&x);
        while(s.count(y))y++;
        if(s.count(0)||x<y-1||(x==y-1&&s.size()>y-1)){
            cout<<"No"<<endl;
            continue;
        }
        cout<<"Yes"<<endl;
        while(s.count(x)) s.erase(x--);
        s.insert(x);
    }
}

```