#include <bits/stdc++.h>

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

  vector<int> va(n);
  for (int i = 0; i < n; ++i) {
    cin >> va[i];
  }

  int max_p = 3 * pow(10, 5);
  vector<int> cnts(max_p, 0);
  int cur = 0;

  vector<int> ans;
  for (int i = 0; i < n; ++i) {
    cnts[va[i]]++;

    while (cnts[cur] > 0) {
      cur++;
    }

    ans.push_back(cur);
  }

  for (int i = 0; i < ans.size(); ++i) {
    cout << ans[i] << '\n';
  }

  return 0;
}
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
typedef long long ll; typedef long double ld; typedef vector <int> vi; typedef vector <ll> vll; typedef vector <string> vS; typedef vector <vector <int>> vv; typedef map<int, int> mi; typedef map<string, int> ms; typedef map<char, int> mc; typedef string S; typedef map <ll, ll> ml; typedef map <int, bool> mb; typedef vector <ld> vld; typedef vector <bool> vb; typedef map<ll, ll> mll;
#define FOR(i,N) for(int i = 0 ; i < N;i++)
#define eFOR(i,a,b) for(int i = a; i <=b;i++)
#define dFOR(i,N) for(int i = N - 1; i>=0;i--)
#define edFOR(i,a,b) for(int i = b ; i >=a;i--)
#define all(x) x.begin(),x.end()
#define SORT(x) sort(all(x))
#define RSORT(x) sort(x.rbegin(),x.rend())
#define mine(x) min_element(all(x))
#define maxe(x) max_element(all(x))
#define pb push_back
#define PI 3.14159265359
const int mod = 1e9 + 7;
int CASE = 1;
ll __gcd(ll a, ll b)
{
	return !b ? a : __gcd(b, a % b);
}
void solve()
{
	int n;
	cin >> n;
	mb mp;
	int k = 0;
	FOR(i, n)
	{
		int x;
		cin >> x;
		mp[x] = true;
		while (mp[k])
			k++;
		cout << k << endl;
	}
}
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int T = 1;
	while (T--)
	{
		solve();
	}
}