/**
 *   Author:  Wasi Ur Rahman
 *   FROM RMSTU
**/
#include <bits/stdc++.h>
#define ll                     long long
#define boost                  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ticktock               cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n"
#define min3(a,b,c)            min(a,min(b,c))
#define min4(a,b,c,d)          min(d,min3(a,b,c))
#define max3(a,b,c)            max(a,max(b,c))
#define max4(a,b,c,d)          max(d,max3(a,b,c))
#define all(v)                 v.begin(),v.end()
#define revall(v)              v.rbegin(),v.rend()
#define pb                  	push_back
#define eb                     emplace_back
#define mk                     make_pair
#define setbits(x)             __builtin_popcountll(x)
#define zrobits(x)             __builtin_ctzll(x)
#define si(x)               	scanf("%d", &x)
#define sii(x, y)           	scanf("%d %d", &x, &y)
#define siii(x, y, z)       	scanf("%d %d %d", &x, &y, &z)
#define siiii(p,x, y, z)    	scanf("%d %d %d %d",&p, &x, &y, &z)
#define sll(x, y)           	scanf("%lld %lld", &x, &y)
#define slll(x, y, z)       	scanf("%lld %lld %lld", &x, &y, &z)
#define read                	freopen("input.txt","r",stdin)
#define write               	freopen("output.txt","w",stdout)
#define println()          		cout << endl
#define no                      cout << "NO" << endl
#define yes                     cout << "YES" << endl
#define printi(x)           	printf("%d\n")
#define printii(x,y)        	printf("%d %d\n")
#define printiii(x,y,z)     	printf("%d %d %d\n")
#define printl(x)           	printf("%lld\n")
#define printll(x,y)        	printf("%lld %lld\n")
#define printlll(x,y,z)     	printf("%lld %lld %lld\n")
using namespace std;
/*************************************
*          A S S E M B L E           *
**************************************/
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
bool Prime(ll n){if(n <= 1)return false;for (ll i = 2; i<=sqrt(n); i++)if (n % i == 0)return false;return true;}
const int mod = 1e9+7;
ll add(ll a,ll b){if((a+=b)>=mod)a-=mod;return a;}
inline int dec(int a,int b){if((a-=b)<0)a+=mod;return a;}
ll mult(ll a,ll b){long long t=1ll*a*b;if(t>=mod)t%=mod;return t;}
ll power(ll a,ll b){ll out=1;while(b){if(b&1)out=mult(out,a);a=mult(a,a);b>>=1;}return out;}
ll modpow(ll a, ll n, ll mod){ll res=1;while(n>0){if(n&1) res=res*a%mod;a=a*a%mod;n>>=1;}return res;}
ll modinverse(ll a,ll M){return modpow(a,M-2,M);}
int main(){
    boost;
    int n;
    cin >> n;
    vector<int> v(n);
    int arr[200001];
    memset(arr,0,sizeof(arr));
    for(int i = 0;i<n;i++)
    {
        cin >> v[i];
    }
    vector<int> ans;
    int m = 0;
    for(int i = 0;i<n;i++){
        arr[v[i]]++;
        if(arr[m] == 0)
            cout << m << endl;
        else{
            while(arr[m] != 0)
                m++;
            cout << m << endl;
        }
    }
}

#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch NeqMin | diff NeqMin.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address NeqMin.cpp && ./a.out

/*

 10/10/2020

 5:06-

 */

const int MAX_N=1e6+1;
int P[MAX_N];
int N;

void solve() {
  VI viz(MAX_N,0);
  int res=0;
  REP(i,N) {
    viz[P[i]]=1;
    while(viz[res]==1) ++res;
    cout<<res<<endl;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;

  cin>>N;
  REP(i,N) cin>>P[i];
  solve();

  return 0;
}
