#include<iostream>
#include<algorithm>
using namespace std;
long long n,a,b[1000000],c,p;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;if(b[0]==1 || c>a){cout<<"No"<<endl;continue;}
		if(c==a && p!=a){cout<<"No"<<endl;continue;}p++;
		if(a>=1000000){cout<<"Yes"<<endl;continue;}
		b[a]++;while(b[a]>=2){b[a]-=2;b[a-1]++;a--;p--;}
		while(c<=999998 && b[c+1]==1)c++;
		cout<<"Yes"<<endl;
	}
	return 0;
}
### Prompt

Create a solution in Cpp for the following problem:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include<iostream>
#include<algorithm>
using namespace std;
long long n,a,b[1000000],c,p;
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a;if(b[0]==1 || c>a){cout<<"No"<<endl;continue;}
		if(c==a && p!=a){cout<<"No"<<endl;continue;}p++;
		if(a>=1000000){cout<<"Yes"<<endl;continue;}
		b[a]++;while(b[a]>=2){b[a]-=2;b[a-1]++;a--;p--;}
		while(c<=999998 && b[c+1]==1)c++;
		cout<<"Yes"<<endl;
	}
	return 0;
}
```