#include<bits/stdc++.h>
using namespace std;
int c[500001];

int main(){
  int n;
  cin>>n;
  int len=0,mx=0;
  while(n--){
    int x;
    cin>>x;
    mx=max(mx,x);
    x=min(x,500000);
    if(!c[0]&&(len<x||(len==x&&mx<=x))){
      while(++c[x]==2)c[x--]=0;
      int llen=max(len,1);
      while(c[llen])llen++;
      len=llen-1;
      cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
  }
  return 0;
}
### Prompt

Your challenge is to write 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 c[500001];

int main(){
  int n;
  cin>>n;
  int len=0,mx=0;
  while(n--){
    int x;
    cin>>x;
    mx=max(mx,x);
    x=min(x,500000);
    if(!c[0]&&(len<x||(len==x&&mx<=x))){
      while(++c[x]==2)c[x--]=0;
      int llen=max(len,1);
      while(c[llen])llen++;
      len=llen-1;
      cout<<"Yes"<<endl;
    }
    else cout<<"No"<<endl;
  }
  return 0;
}
```