#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define fi first
#define se second
#define endl '\n'
// #define int int64_t
#define double long double
template<int D, typename T>struct dense:public vector<dense<D-1,T>>{static_assert(D>=1,"dim err");template<typename... Args>dense(int n=0,Args... args):vector<dense<D-1,T>>(n,dense<D-1,T>(args...)){}};
template<typename T>struct dense<1,T>:public vector<T>{dense(int n=0,const T& val=T()):vector<T>(n,val){}};
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using reverse_queue = priority_queue<T, vector<T>, greater<T>>;
mt19937_64 rnd(time(0));
const int FIXED_RANDOM = rnd();
template<typename T> struct custom_hash{T operator()(T x)const{return (T) x^FIXED_RANDOM;}}; // check hash in whether int64 or int32
template<typename T1, typename T2> using hash_map = gp_hash_table<T1, T2, custom_hash<T1>>;
const int MAXN = (int) 1e5 + 2;
const int INF = numeric_limits<int>::max() >> 3;
const int MOD = (int) 1e9 + 7;
signed main(){
  ios_base::sync_with_stdio(0); 
  cin.tie(0);
  // freopen("FDT.txt", "r", stdin);
  int n;
  cin >> n;
  set<int> s;
  for(int i = 0; i <= n; i ++) s.insert(i);
  for(int i = 1; i <= n; i ++){
    int u;
    cin >> u;
    s.erase(u);
    cout << (*s.begin()) << endl;
  }
}
#include <iostream>
using namespace std;
bool used[200500];
int m,n,i;
int main() {
	cin>>n;
	while (n--) {
		cin>>i;
		used[i]=true;
		while(used[m]) m++;
		cout<<m<<endl;
	}
    return 0;
}