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

int main(){
	int N;
	cin >> N;
	vector<int> b(N);
	vector<int> ans(N);
	for(auto &k:b)cin >> k;
	
	for(int k=0;k<N;k++){
		
		for(int i=b.size()-1;i>=0;i--){
			if(b[i]>i+1){
			cout << "-1" << endl;
			return 0;
			}
			if(b[i]==i+1){
				ans[N-k-1]=i+1;
				b.erase(b.begin()+i);
				break;
			}
		}
	}
	for(auto a:ans)cout << a << endl;
	return 0;
}