local n = io.read("*n")
local t = {}
local ret = {}
for i = 1, n do
  t[i] = io.read("*n")
  ret[i] = 0
end
local found = false
for i = n, 1, -1 do
  found = false
  for k = i, 1, -1 do
    if t[k] == k then
      ret[i] = k
      table.remove(t, k)
      found = true
      break
    end
  end
  if not found then break end
end
if not found then print(-1)
else
  for i = 1, n do print(ret[i]) end
end