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

bool bits[1<<20] = {0}; 
int lb = 1, bitcnt = 0;

bool inc(int i) {
  if (bits[0] or i < lb - 1 or (i == lb - 1 and bitcnt > lb - 1)) return false;
  while (bits[i] == 1) bits[i] = 0, lb -= lb == i, --i, --bitcnt;
  bits[i] = 1, ++bitcnt;
  while (bits[lb]) ++lb;
  return true;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int Q; cin >> Q;
  for (int x; Q; --Q) {
    cin >> x, cout << (inc(min(x, (1<<20) - 1)) ? "Yes" : "No") << '\n';
    //for (int i = 0; i < 10; ++i) cout << bits[i] << " \n"[i == 9];
    //cout << lb << '\n';
  }
}


### Prompt

Develop a solution in cpp to the problem described below:

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;

bool bits[1<<20] = {0}; 
int lb = 1, bitcnt = 0;

bool inc(int i) {
  if (bits[0] or i < lb - 1 or (i == lb - 1 and bitcnt > lb - 1)) return false;
  while (bits[i] == 1) bits[i] = 0, lb -= lb == i, --i, --bitcnt;
  bits[i] = 1, ++bitcnt;
  while (bits[lb]) ++lb;
  return true;
}

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);
  int Q; cin >> Q;
  for (int x; Q; --Q) {
    cin >> x, cout << (inc(min(x, (1<<20) - 1)) ? "Yes" : "No") << '\n';
    //for (int i = 0; i < 10; ++i) cout << bits[i] << " \n"[i == 9];
    //cout << lb << '\n';
  }
}


```