#include <bits/stdc++.h>
using namespace std;

int n;
vector <int> b, rlt;

int main()
{
    scanf("%d", &n);
    b.resize(n);
    for (int i = 0; i < n; i ++) scanf("%d", &b[i]);
    while (n --)
    {
        int k = n;
        while (k >= 0 && b[k] != k + 1) k --;
        if (k < 0) return printf("-1"), 0;
        rlt.push_back(k + 1), b.erase(b.begin() + k);
    }
    reverse(rlt.begin(), rlt.end());
    for (int i = 0; i < rlt.size(); i ++) printf("%d\n", rlt[i]);
}
