#include<bits/stdc++.h>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(a) (a).begin(),(a).end()

int main(){
  int n; cin >> n;
  set<int> st;
  int mx = 0;
  REP(i, n)
  {
    int x;
    cin >> x;
    if(st.count(0) || mx > x) cout << "No" << endl;
    else if(mx == x && st.size() > x) cout << "No" << endl;
    else
    {
      cout << "Yes" << endl;
      int t = x;
      while(1)
      {
        if(st.count(t) == 0)
        {
          st.insert(t);
          if(t - mx == 1) 
          {
            for(int j = t;; j++)
            {
              if(st.count(j) == 0) break;
              mx++;
            }
          }
          break;
        }
        else
        {
          st.erase(t);
          t--;
        }
      }
    }

  }



  return 0;
}
### Prompt

In cpp, your task is to solve 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;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(a) (a).begin(),(a).end()

int main(){
  int n; cin >> n;
  set<int> st;
  int mx = 0;
  REP(i, n)
  {
    int x;
    cin >> x;
    if(st.count(0) || mx > x) cout << "No" << endl;
    else if(mx == x && st.size() > x) cout << "No" << endl;
    else
    {
      cout << "Yes" << endl;
      int t = x;
      while(1)
      {
        if(st.count(t) == 0)
        {
          st.insert(t);
          if(t - mx == 1) 
          {
            for(int j = t;; j++)
            {
              if(st.count(j) == 0) break;
              mx++;
            }
          }
          break;
        }
        else
        {
          st.erase(t);
          t--;
        }
      }
    }

  }



  return 0;
}
```