#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,i,j;
    cin >> a;
    set<int>st;
    vector<int>vec;
    for(i=0;i<=2*a+1;i++)
        st.insert(i);
    for(j=0;j<a;j++)
    {
        cin >> c;
        if(st.count(c))
        {
            st.erase(c);

        }
        vec.push_back(*st.begin());
    }
for(i=0;i<vec.size();i++)
{
    cout << vec[i] << " ";
}
cout << endl;

}

#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <stack>
#include <queue>
#include <tuple>
#include <regex>
#include <cmath>
#include <map>
#include <set>
#include <functional>
#include <cstring>

using namespace std;

template<typename T> bool chmax( T &a, const T b ) { if ( a <= b ) { a = b; return ( true ); } else { return ( false ); } }
template<typename T> bool chmin( T &a, const T b ) { if ( a >= b ) { a = b; return ( true ); } else { return ( false ); } }

using ll = long long;
using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;

#define eb emplace_back
#define pb push_back
#define mp make_pair

#define F first
#define S second

#define popcnt __builtin_popcountll

#define rep( i, n ) for ( ll i = 0; i < (ll)( n ); ++i )
#define reps( i, n ) for ( ll i = 1; i <= (ll)( n ); ++i )
#define rrep( i, n ) for ( ll i = (ll)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( ll i = (ll)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

template<typename T = ll> constexpr T MAX = numeric_limits<T>::max();
template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }
template<typename T> T lcm( const T a, const T b ) { return ( a / gcd( a, b ) * b ); }


int main()
{
	ll n; cin >> n;
	vector<ll> p( n );
	rep( i, n ) cin >> p[i];
	priority_queue<ll, vector<ll>, greater<ll>> pq;
	map<ll, ll> m;
	rep( i, 200001 ) pq.push( i );

	rep( i, n )
	{
		m[p[i]]++;
		auto x = pq.top();
		while ( m[x] >= 1 )
		{
			pq.pop();
			x = pq.top();
		}
		cout << x << endl;
	}

	return ( 0 );
}
