#include <bits/stdc++.h>
using namespace std;
class DSU {
public:
DSU(int n) : _n(n) {
_fa = vector<int>(n, -1);
_sz = vector<int>(n, 0);
}
void create(int x) {
_fa[x] = x;
_sz[x] = 1;
}
int find(int x) {
if (_fa[x] == -1) return -1;
if (_fa[x] == x) return x;
return _fa[x] = find(_fa[x]);
}
bool merge(int x,int y) {
if (x == -1 || y == -1) return false;
int fx = find(x), fy = find(y);
if (fx == -1 || fy == -1) return false;
if (fx == fy) return false;
_fa[fy] = _fa[fx];
_sz[fx] += _sz[fy];
return true;
}
int get_sz(int x) {
return _sz[find(x)];
}
private:
int _n;
vector<int> _fa, _sz;
};
const int N=200010;
int main()
{
int n;
scanf("%d",&n);
DSU dsu(N);
int pos=0;
for (int i=0;i<n;i++) {
int x;
scanf("%d",&x);
dsu.create(x);
dsu.merge(x,x-1);
dsu.merge(x,x+1);
while (dsu.find(pos) != -1) ++pos;
printf("%d\n", pos);
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpjbGFzcyBEU1UgewpwdWJsaWM6CiAgICBEU1UoaW50IG4pIDogX24obikgewogICAgICAgIF9mYSA9IHZlY3RvcjxpbnQ+KG4sIC0xKTsKICAgICAgICBfc3ogPSB2ZWN0b3I8aW50PihuLCAwKTsKICAgIH0KICAgIHZvaWQgY3JlYXRlKGludCB4KSB7CiAgICAgICAgX2ZhW3hdID0geDsKICAgICAgICBfc3pbeF0gPSAxOwogICAgfQogICAgaW50IGZpbmQoaW50IHgpIHsKICAgICAgICBpZiAoX2ZhW3hdID09IC0xKSByZXR1cm4gLTE7CiAgICAgICAgaWYgKF9mYVt4XSA9PSB4KSByZXR1cm4geDsKICAgICAgICByZXR1cm4gX2ZhW3hdID0gZmluZChfZmFbeF0pOwogICAgfQogICAgYm9vbCBtZXJnZShpbnQgeCxpbnQgeSkgewogICAgICAgIGlmICh4ID09IC0xIHx8IHkgPT0gLTEpIHJldHVybiBmYWxzZTsKICAgICAgICBpbnQgZnggPSBmaW5kKHgpLCBmeSA9IGZpbmQoeSk7CiAgICAgICAgaWYgKGZ4ID09IC0xIHx8IGZ5ID09IC0xKSByZXR1cm4gZmFsc2U7CiAgICAgICAgaWYgKGZ4ID09IGZ5KSByZXR1cm4gZmFsc2U7CiAgICAgICAgX2ZhW2Z5XSA9IF9mYVtmeF07CiAgICAgICAgX3N6W2Z4XSArPSBfc3pbZnldOwogICAgICAgIHJldHVybiB0cnVlOwogICAgfQogICAgaW50IGdldF9zeihpbnQgeCkgewogICAgICAgIHJldHVybiBfc3pbZmluZCh4KV07CiAgICB9CnByaXZhdGU6CiAgICBpbnQgX247CiAgICB2ZWN0b3I8aW50PiBfZmEsIF9zejsKfTsKCmNvbnN0IGludCBOPTIwMDAxMDsKCmludCBtYWluKCkKewogICAgaW50IG47CiAgICBzY2FuZigiJWQiLCZuKTsKICAgIERTVSBkc3UoTik7CiAgICBpbnQgcG9zPTA7CiAgICBmb3IgKGludCBpPTA7aTxuO2krKykgewogICAgICAgIGludCB4OwogICAgICAgIHNjYW5mKCIlZCIsJngpOwogICAgICAgIGRzdS5jcmVhdGUoeCk7CiAgICAgICAgZHN1Lm1lcmdlKHgseC0xKTsKICAgICAgICBkc3UubWVyZ2UoeCx4KzEpOwogICAgICAgIHdoaWxlIChkc3UuZmluZChwb3MpICE9IC0xKSArK3BvczsKICAgICAgICBwcmludGYoIiVkXG4iLCBwb3MpOwogICAgfQogICAgcmV0dXJuIDA7Cn0=