//! flag: -g3, -DWAAUTOMATON
//! link: m,stdc++
#include <bits/stdc++.h>
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#define massert(x) assert(x)
#else
#define debug(args...) // Just strip off all debug tokens
#define massert(x)
#endif
using namespace std;
typedef unsigned uint;
typedef long long LL;
typedef unsigned long long ULL;
typedef std::pair<int, int> pii;
typedef std::pair<LL, LL> pll;
struct debugger
{
    template <typename T>
    debugger &operator,(const T &v)
    {
        std::cerr << v << " ";
        return *this;
    }
} dbg;

template <typename T>
inline void chmax(T &a, T b)
{
    a = std::max(a, b);
}

template <typename T>
inline void chmin(T &a, T b)
{
    a = std::min(a, b);
}

template <typename T>
inline T sqr(const T& x)
{
	return x*x;
}

template <size_t _I_Buffer_Size = 1 << 23, size_t _O_Buffer_Size = 1 << 23>
struct IO_Tp
{
    char _I_Buffer[_I_Buffer_Size];
    char *_I_pos;
    const char *_I_end;

    char _O_Buffer[_O_Buffer_Size];
    char *_O_pos;
    const char *_O_end;

    IO_Tp()
        : _I_pos(_I_Buffer)
        , _O_pos(_O_Buffer)
        , _I_end(_I_Buffer + _I_Buffer_Size)
        , _O_end(_O_Buffer + _O_Buffer_Size)
    {
    }

    ~IO_Tp() { fwrite(_O_Buffer, 1, _O_pos - _O_Buffer, stdout); }

    inline char getchar()
    {
        char res = *_I_pos;
        nextchar();
        return res;
    }

    inline bool is_digit(const char ch) { return '0' <= ch && ch <= '9'; }

    inline void nextchar()
    {
        ++_I_pos;
        if (_I_pos == _I_end) {
            fread(_I_Buffer, 1, _I_Buffer_Size, stdin);
            _I_pos = _I_Buffer;
        }
    }

    template <typename Int>
    inline IO_Tp &operator>>(Int &res)
    {
        res = 0;
        int k = 1;
        while (!is_digit(*_I_pos)) {
            if (*_I_pos == '-')
                k = -1;
            nextchar();
        }
        do {
            (res *= 10) += (*_I_pos) - '0';
            nextchar();
        } while (is_digit(*_I_pos));
        res *= k;
        return *this;
    }

    inline IO_Tp &operator>>(char &res)
    {
        do {
            res = *_I_pos;
            nextchar();
        } while (res == ' ' || res == '\0' || res == '\t' || res == '\n' || res == '\r');
        return *this;
    }

    inline void putchar(char x)
    {
        if (_O_pos == _O_end) {
            fwrite(_O_Buffer, 1, _O_pos - _O_Buffer, stdout);
            _O_pos = _O_Buffer;
        }
        *_O_pos++ = x;
    }
    template <typename Int>
    inline IO_Tp &operator<<(Int n)
    {
        if (n < 0) {
            putchar('-');
            n = -n;
        }
        static char _buf[20];
        char *_pos(_buf);
        do
            *_pos++ = '0' + n % 10;
        while (n /= 10);
        while (_pos != _buf)
            putchar(*--_pos);
        return *this;
    }

    inline IO_Tp &operator<<(char ch)
    {
        putchar(ch);
        return *this;
    }

    inline IO_Tp &operator<<(const char *s)
    {
        while (*s != 0) {
            putchar(*s);
            ++s;
        }
        return *this;
    }
};
IO_Tp<> IO;

int main()
{
#ifdef WAAUTOMATON
    freopen("./in_A_3.txt", "r", stdin);
#endif
	int n;
	IO>>n;
	vector<int> a;
	for(int i=1; i<=n; ++i) {
		int t;
		IO>> t;
		a.push_back(t);
	}
	stack<int> b;
	for(int i=n; i>=1; --i) {
		bool flag=true;
		for(int j=i; j>=1; --j) {
			if (a[j-1]==j) {
				a.erase(a.begin()+(j-1));
				b.push(j);
				flag=false;
				break;
			}
		}
		if (flag) {
			puts("-1");
			return 0;
		}
	}
	while(!b.empty()) {
		IO<<b.top()<<'\n';
		b.pop();
	}
    return 0;
}



Measured memory_bytes: 2304