#include<iostream>
#include<algorithm>
#include<cstdio>
#include<map>
using namespace std;
map<int,int> M;
int x,n,T=0;
int main(){
	int bj=0,maxn=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		if(bj){puts("No");continue;}
		if(x<=T){
//			cout<<maxn<<endl;
			if(maxn>x)	puts("No");
			else		puts("Yes"),bj=1;
			continue;
		}
		maxn=max(maxn,x);
		M[x]++;puts("Yes");
		while(M[x]==2){maxn=maxn==x?maxn-1:maxn;M[x]=0;M[--x]++;}
		while(M[T+1])	T++;
	}
}


### Prompt

Construct a Cpp code solution to the problem outlined:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<map>
using namespace std;
map<int,int> M;
int x,n,T=0;
int main(){
	int bj=0,maxn=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&x);
		if(bj){puts("No");continue;}
		if(x<=T){
//			cout<<maxn<<endl;
			if(maxn>x)	puts("No");
			else		puts("Yes"),bj=1;
			continue;
		}
		maxn=max(maxn,x);
		M[x]++;puts("Yes");
		while(M[x]==2){maxn=maxn==x?maxn-1:maxn;M[x]=0;M[--x]++;}
		while(M[T+1])	T++;
	}
}


```