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

int main () {
	 ios::sync_with_stdio(false);
	 cin.tie(nullptr);
	 cout.tie(nullptr);
	 int T = 1;
	 //~ cin >> T;
	 for (int t = 1; t <= T; ++t) {
		 int n;
		 cin >> n;
		 int input[n + 1];
		 for (int i = 1; i <= n; ++i) {
			 cin >> input[i];
		 }
		 set<int> nums;
		 nums.insert(0);
		 for (int i = 1; i <= n; ++i) {
			 nums.insert(i);
		 }
		 for (int i = 1; i <= n; ++i) {
			 set<int>:: iterator it = nums.begin();
			 if (*it == input[i]) {
				 nums.erase(it);
				 it = nums.begin();
				 cout << *it << "\n";
			 } else {
				 while (i <= n and *it != input[i]) {
					 cout << *it << "\n";
					 nums.erase(input[i]);
					 ++i;
				 }
				 if (i <= n) {
					 nums.erase(it);
					 it = nums.begin();
					 cout << *it << "\n";
				 }
			 }
		 }
	 }
}

#include "bits/stdc++.h"
// #include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all> 
// using namespace atcoder;
using ll = long long;

template <typename T>
void print_vec(const vector<T>& v, bool is_reverse=false, ll num=0){
  if(num == 0) num = (ll)v.size();
  cout << endl; cout << "i=  ";for(ll i=0; i<num; i++) cout << i << "   ";cout << endl;  
  cout << "    ";
  if(is_reverse) for(ll i=num-1; i>=0; i--){ cout<<v[i]; if(i!=0) cout<<"   ";}
  else for(ll i=0; i<num; i++){ cout<<v[i]; if(i!=num-1) cout<<"   ";}
  cout << endl;
}

// template <typename T>
// void print_pairvec(const vector<T> &v, ll num=0){
//   if(num == 0) num = (ll)v.size();
//   cout << endl; for(ll i=0; i<num; i++){ cout << v[i].first << " " << v[i].second << endl;}
// }
template <typename T>
void print_pairvec(const T &_pair, ll num=0){
  cout << endl; for(pair<ll, int> x: _pair){ cout << x.first << " " << x.second << endl;}
}

template <typename T>
void print_vec2(const vector<vector<T>>& v){
  cout << endl; cout << "       ";
  for(ll i=0; i<v[0].size(); i++) cout << i << "   "; 
  cout << endl;
	for(ll i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(ll j=0; j<v[i].size(); j++){
			if(v[i][j] == 0) cout << "\x1B[0m" << v[i][j] << "   ";
      else cout << "\x1B[31m" << v[i][j] << "   ";//https://stackoverrun.com/ja/q/12618775
		}
		cout << "\x1B[0m" << endl;
	}
}

int main(){
  ll N;
  cin >> N ;
  vector<ll> p(N);

  vector<bool> is_p(N+1, false);
  for(int i=0; i<N; i++) cin >> p[i];
  // for(int i=0; i<N; i++) is_p[p[i]] = true;


  ll ans = 0;
  for(int i=0; i<N; i++){
    is_p[p[i]] = true;
    while(is_p[ans] == true) ans++;
    cout << ans << endl;
  }
  
  // cout << ans << endl;

  return 0;
  // cout << fixed;//小数点を確実に10桁で表示するためのもの
  // cout << setprecision(10); 
}
