    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    using P=pair<int,int>;
    const ll INF=1e18;
    const int mod=998244353;

    int main(){
      int n;
      cin>>n;
      vector<int>cnt(200005);
      int j=0;
      rep(i,n){
        int p;
        cin>>p;
        cnt[p]++;
        while(j<=200000&&cnt[j]){j++;}
        cout<<j<<endl;
      }
      return 0;
    }
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  
  int ans = 0;
  map<int, bool> m;
  for (int i=0; i<N; i++) {
    int p;
    cin >> p;
    m[p] = true;
    for (int j=ans; j<=200000; j++) {
      if (!m.count(j)) {
        cout << j << endl;
        ans = j;
        break;
      }
    }
  }
}
