program main
implicit none
integer :: n
integer , allocatable :: b(:)

read(*,*) n
allocate(b(n))
read(*,*) b(1:n)

do i = 1, n
   if(b(i) > i ) then
      write(*,'(i0)') -1
      stop
   end if
end do


end program main
