#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;

int main() {
    int N; cin >> N;
    vector<bool> memo(222222, false);
    int ans = 0;
    rep(i, N) {
        int p; cin >> p;
        memo[p] = true;
        while(true){
            if(!memo[ans]){
                cout << ans << endl;
                break;
            }
            ans++;
        }
    }
    return 0;
}
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<unordered_map>
using namespace std;

#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))

const double pi = acos(-1);
const int N = 2e5 + 100;
const int mod = 1e9 + 7;
typedef long long ll;
template<typename T> 
inline void read(T &x) {
	x = 0;
	int  w = 1;
	char ch = 0;
	while (ch < '0' || ch > '9') {
		if (ch == '-') w = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		x = (x << 1) + (x << 3) + (ch - 48);
		ch = getchar();
	}
	x *= w;
}

int p[N],a[N],t[N]{0}, x = 0;

void qwq() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; ++i){
		scanf("%d",&p[i]);
		t[p[i]] = 1;
		while(t[x]) x++;
		a[i] = x;
	}
	for(int i = 1; i <= n; ++i){
		printf("%d\n", a[i]);
	}
}


 int main() {
	int _ = 1;
	//read(_);
	while (_--) qwq();
	return 0;
}
