#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long N; cin >> N;
    vector<long> used(200000);
    for(long i = 0; i < N; i++){
        used[i] = 0;
    }

    long now_min = 0;
    for(long i = 0; i < N; i++){
        long p; cin >> p;
        used[p] = 1;

        if(p == now_min){
            while(true){
                now_min ++;
                if(used[now_min] == 0) break;
            }
        }

        cout << now_min << endl;
    }
}
#include<bits/stdc++.h>
using namespace std;
#define debug(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
#define sz(a) ll(a.size())
void solve(){
	ll n;
	cin>>n;
	set<ll> s;
	for(ll i=0;i<n+10;i++)
		s.insert(i);
	for(ll i=0;i<n;i++){
		ll x;
		cin>>x;
		s.erase(x);
		cout<<(*s.begin())<<"\n";
	}
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
    #endif
    clock_t z=clock();
    ll qc=1;
    //cin>>qc;
    for(ll i=1;i<=qc;i++){
        solve();
    }
    debug("Total Time:%.4Lf\n",(ld)(clock()-z)/CLOCKS_PER_SEC);
}