#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> a(200010);
  int ans = 0;
  for(int i = 0; i < n; i++){
    int p;
    cin >> p;
    a[p] = 1;
    while(a[ans] == 1) ans++;
    cout << ans << endl;
  }
}
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
using namespace std;
using ll = long long;

int main()
{
    int N;
    cin >> N;

    vector<int> n;

    rep(i, 0, N + 1)
    {
        n.push_back(i);
    }

    vector<int> ans;

    rep(i, 0, N)
    {
        int p;
        cin >> p;

        auto it = lower_bound(n.begin(), n.end(), p);

        if (it != n.end())
        {
            if (p == *it)
            {
                n.erase(it);
            }
        }

        ans.push_back(*n.begin());
    }

    rep(i, 0, N)
    {
        cout << ans[i] << endl;
    }
}
