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

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n;
	cin>>n;
	int a[n];
	for (int i=0;i<n;i++) cin>>a[i];
	vector<int> sav(200007,0);
	int m=0;int nm=1;
	for (int i=0;i<n;i++)
	{
		sav[a[i]]=1;
		
		if (sav[m]!=0)
		{
			
			while (sav[m]!=0)
			{
				m++;
			}
			
			cout<<m<<"\n";
		}
		else
		{
			cout<<m<<"\n";
		}
		
	}
	return 0;
}
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define endl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define all(x) x.begin(),x.end()
#define y1 omg
#define INF 1000000010
#define FOR(x, n) for(int x=0; x<n; x++)
#define ini(x, n) memset(x, n, sizeof(x));
#define MOD ((int)1e9 + 7)
#define atoi(x) ((x)-'0')
#define int ll
//#define double long double
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, 1, -1, 1, -1 };

int n, t;
set<int> S;

signed main() {
	fastio;
	cin >> n;
	FOR(i, n + 1) S.insert(i);
	FOR(i, n) {
		cin >> t;
		S.erase(t);
		cout << *S.begin() << endl;
	}
}