#include <bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define f first
#define s second
#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define RFOR(i, b, a) for (int i = b-1; i>=a; --i)
#define FILL(a, b) memset(a, b, sizeof a)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)a.size()
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef pair<LL, LL> PLL;
const int INF = 1000 * 1000 * 1000;
const LL LINF = 1LL * INF*INF;
const int MAX = 100010;
const long double PI = acos(-1.);
const double EPS = 1e-6;
LL mod = 1000LL*1000*1000 + 7;
VI g[100*1000+7];
int u[100*1000+7];
int dfs(int v,int v2)
{
	if(v==v2)
		return 1;
	u[v] = 1;
	FOR(i,0,SZ(g[v]))
		if(!u[g[v][i]])
			return dfs(g[v][i],v2);
	return 0;
}
int main()
{
	ios_base::sync_with_stdio(0); double startClock = clock();
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	VI arr(n);
	FOR(i,0,n)
	{
		cin >> arr[i];
	}
	VI res;
	FOR(i,0,n)
	{
		int cnt = 0;
		int pos = -1;
		FOR(j,0,n)
		{
			if(arr[j]==-1) continue;
			cnt++;
			if(arr[j]==cnt)
				pos = j;
		}
		if(pos==-1)
		{
			cout << -1;
			return 0;
		}
		res.PB(arr[pos]);
		arr[pos] = -1;
	}
	reverse(ALL(res));
	FOR(i,0,n)
		cout << res[i] << endl;
	cerr << endl << (clock() - startClock)/CLOCKS_PER_SEC << endl;return 0;
}
