n = gets.chomp.to_i
@b = gets.split(' ').map(&:to_i)
@removed_values = []

def remove_max
	s = @b.size
	@b.each_with_index do |_, idx|
		t = s - idx
		if @b[t - 1] == t
			@removed_values << @b.delete_at(t - 1)
			return true
		end
	end
	return false
end

def check
	while @b.size > 0	
		return false unless remove_max
	end
	return true
end


if check
	@removed_values.reverse.each do |i|
		print i
		print "\n" if i != @b.size
	end
else
	print -1
end
