#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
typedef vector<int> vi;
typedef vector<string> vs;
const int mod = 1000000007;
const int inf = 1061109567;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
signed main()
#define N_MAX 200200
{   
    int n;
    cin >> n;
    vi p(n);
    vector<bool> check(N_MAX, false);
    set <int> s;
    int x;
    int ans = 0;
    rep(i,n){
        cin >> x;
        if(check[x]) { cout << ans << endl; continue;}
        check[x] = true;
        while(1){
            if(!check[ans]) { cout << ans << endl; break;}
            ans++;
        }

    }

    return 0;
}
#define _GLIBCXX_DEBUG//これが最後の手段だ!
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//
#include<cmath>
#include<iomanip>

//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

typedef long long ll;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); 

  int n,m = 0;
  cin >> n;
  vector<int> p(n),a(200002),b(200002);

  for (int i = 1; i <= 200001; i++){
    a[i] = i;
  }
  
  for (int i = 0; i < n; i++){
    cin >> p[i];
    b[p[i]] = 1;
    while(b[m] == 1) ++m;
    cout << m << '\n';
  }

  

  return 0;
}