// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int n;

	cin>>n;

	int a[n+1],b[n+1];

	for(int i=1;i<=n;i++)

	{

		cin>>a[i];

	}

	int index=1;

	int N=n;

	for(int i=n;i>=1;)

	{

		if(a[i]==i)

		{

			b[index]=a[i];

			index++;

			for(int j=i;j<=n;j++)

			{

				a[j]=a[j+1];

			}

			n--;

			i=n;

		}

		else

		{

			i--;

		} 

	}

	if(index-1==N)

	{

		for(int i=N;i>=1;i--)

		{

			cout<<b[i]<<endl;

		}

	}

	else

	{

		cout<<"-1"<<endl;

	}

	return 0;

} 

// Fastest known solution for this problem:
#include <bits/stdc++.h>



#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))



using namespace std;

using ll = long long;

using pii = pair<int, int>;

using pipipii = pair<ll, pair<int, pii>>;



constexpr int MOD = 1'000'000'007;

constexpr int INF = 1'000'000'001;

constexpr ll LLINF = 4'000'000'000'000'000'001;

// constexpr int INF = 2147483647; // 2 * 1e9

// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18



const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1, 0};

const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1, 0};



int main(){

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout << fixed << setprecision(10);

    int n;

    cin >> n;

    vector<int> b(n);

    for(int i = 0; i < n; ++i){

        cin >> b[i];

    }

    vector<int> ans(n);

    for(int i = 0; i < n; ++i){

        for(int j = (int)b.size() - 1; j >= 0; --j){

            if(j+1 == b[j]){

                ans[i] = j+1;

                b.erase(b.begin() + j);

                goto SUCCESS;

            }

        }

        cout << "-1\n";

        return 0;

        SUCCESS:;

    }

    for(int i = n-1; i >= 0; --i){

        cout << ans[i] << "\n";

    }

    return 0;

}