#include<bits/stdc++.h>

using namespace std;

int main() {
  int n;
  const int Nmax = 200002;
  vector<int> count(Nmax,Nmax);
  cin >> n;
  int p;
  for(int i=0;i<n;i++) {
    cin >> p;
    if(count[p] == Nmax) count[p] = i+1;
  }

  int output = 1;
  for(int i=0;i<Nmax;i++) {
    if(output < count[i]){
      while(output < count[i]) {
	cout << i << endl;
	output++;
	if(output > n) return 0;
      }
    }
    if(output > n) break;
  }
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef vector<int> vi; 
typedef vector<pi> vpi;

#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) begin(x), end(x)
#define rsz resize
#define bk back()
#define pb push_back
#define ins insert
#define del erase
#define inf INT_MAX
#define db cout << "here" << endl;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)
#define nl endl
const int MOD = 1e9+7;
const ld PI = acos((ld)-1);
mt19937 rng; // or mt19937_64
template<class T> bool ckmin(T& a, const T& b) { 
	return b < a ? a = b, 1 : 0; }
ll cdiv(ll a, ll b) { return a/b+((a^b)>0&&a%b); } // divide a by b rounded up
ll fdiv(ll a, ll b) { return a/b-((a^b)<0&&a%b); } // divide a by b rounded down

void DBG() { cerr << "]" << endl; }
template<class H, class... T> void DBG(H h, T... t) {
	cerr << h; if (sizeof...(t)) cerr << ", ";
	DBG(t...); }
#ifdef LOCAL // compile with -DLOCAL
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)
#else
#define dbg(...) 0
#endif
const int MX = 300002;
const int INF = MX+MX;
void solve() {
	int n ;
	cin >> n ;
	int ar[n];
	F0R(i,n) {
		cin >> ar[i];
	}
	int flag[MX];
	F0R(i,200002) flag[i]=false;
	int j = 0;
	F0R(i,n) {
		flag[ar[i]]= true;
		if(j!=ar[i])
		cout << j << endl;
		else {
			for(; j <= 200001; j++) 
			if(flag[j]==false)
			break;
			cout << j << endl;
		}
	}
}
int main() {
	int t;
	t=1;
	while(t--)
	solve();
}
	
