n = int(input()) a = list(map(int, input().split())) for i, x in enumerate(a): if x > i+1: raise ValueError