#include<bits/stdc++.h>
using namespace std;
int n;
int l=1;

set<int> st;

int main(){
  scanf("%d",&n);
  while(n--){
    int x;
    scanf("%d",&x);
    if(st.count(0)>0){
      printf("No\n");
      continue;
    }
    
    while(st.count(l)>0)l++;

    if(x<l-1 || (x==l-1 && (int)st.size()>l-1 ) ){
      printf("No\n");
      continue;
    }

    printf("Yes\n");
    while(st.count(x)>0){
      st.erase(x);
      x--;
    }
    st.insert(x);
  }
  return 0;
}
### Prompt

Your task is to create 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 n;
int l=1;

set<int> st;

int main(){
  scanf("%d",&n);
  while(n--){
    int x;
    scanf("%d",&x);
    if(st.count(0)>0){
      printf("No\n");
      continue;
    }
    
    while(st.count(l)>0)l++;

    if(x<l-1 || (x==l-1 && (int)st.size()>l-1 ) ){
      printf("No\n");
      continue;
    }

    printf("Yes\n");
    while(st.count(x)>0){
      st.erase(x);
      x--;
    }
    st.insert(x);
  }
  return 0;
}
```