#include<iostream>
using namespace std;
int dp[5<<17],bt,m,n,x;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		if(bt==-1)
		{
			cout<<"No"<<endl;
		}
		else if(x>500000)
		{
			m=500001;
			cout<<"Yes"<<endl;
		}
		else if(bt>x)
		{
			cout<<"No"<<endl;
		}
		else if(bt==x)
		{
			if(m>x)cout<<"No"<<endl;
			else
			{
				cout<<"Yes"<<endl;
				bt=-1;
			}
		}
		else
		{
			cout<<"Yes"<<endl;
			dp[x]++;
			if(m<x)m=x;
			while(dp[x]==2)
			{
				dp[x]=0;
				if(m==x)m--;
				dp[--x]++;
			}
			while(dp[bt+1])bt++;
		}
	}
}


### Prompt

Please provide a CPP coded solution to the problem described below:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include<iostream>
using namespace std;
int dp[5<<17],bt,m,n,x;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		if(bt==-1)
		{
			cout<<"No"<<endl;
		}
		else if(x>500000)
		{
			m=500001;
			cout<<"Yes"<<endl;
		}
		else if(bt>x)
		{
			cout<<"No"<<endl;
		}
		else if(bt==x)
		{
			if(m>x)cout<<"No"<<endl;
			else
			{
				cout<<"Yes"<<endl;
				bt=-1;
			}
		}
		else
		{
			cout<<"Yes"<<endl;
			dp[x]++;
			if(m<x)m=x;
			while(dp[x]==2)
			{
				dp[x]=0;
				if(m==x)m--;
				dp[--x]++;
			}
			while(dp[bt+1])bt++;
		}
	}
}


```