N=gets.to_i
BS=gets.split.map(&:to_i)
A=[]
C=[]

ans = "No"

BS.each_with_index do |b, i|
  break if b > i+1
  ans = "Yes"
end

if ans == "No"
  puts "-1"
else
  BS.each do |b|
    A[b-1, 0] = b
  end
  
  A.each do |a|
    C[a-1, 0] = a
  end
  
  if BS==C
    A.each do |a|
      p a
    end
  else
    C.each do |c|
      p c
    end
  end
end
