N = int(eval(input()))

H = [int(x) for x in input().split()]

j = 0

Ans = True



for i in range(N-1):

    if H[i] > H[i+1] + 1:

        Ans = False

    elif H[i] == H[i+1] + 1:

        if H[i-j] == H[i]:

            j = 1

            continue

        else:

            Ans = False

            break

    elif H[i] == H[i+1]:

        j += 1

    else:

        j = 0

        continue



if Ans:

    print("Yes")

else:

    print("No")
n = int(eval(input()))

a = list(map(int, input().split()))



judge = 0

for i in range(n):

  if a[i] < judge:

    print("No")

    break

  judge = max(judge, a[i]-1)

else:

  print("Yes")
N = int(eval(input()))
H = [int(x) for x in input().split()]
j = 0
Ans = True
for i in range(N - 1):
    if H[i] > H[i + 1] + 1:
        Ans = False
    elif H[i] == H[i + 1] + 1:
        if H[i - j] == H[i]:
            j = 1
            continue
        else:
            Ans = False
            break
    elif H[i] == H[i + 1]:
        j += 1
    else:
        j = 0
        continue
if Ans:
    print("Yes")
else:
    print("No")

n = int(eval(input()))
a = list(map(int, input().split()))
judge = 0
for i in range(n):
    if a[i] < judge:
        print("No")
        break
    judge = max(judge, a[i] - 1)
else:
    print("Yes")

-N = int(eval(input())) -H = [int(x) for x in input().split()] -j = 0 -Ans = True -for i in range(N - 1): -    if H[i] > H[i + 1] + 1: -        Ans = False -    elif H[i] == H[i + 1] + 1: -        if H[i - j] == H[i]: -            j = 1 -            continue -        else: -            Ans = False -            break -    elif H[i] == H[i + 1]: -        j += 1 -    else: -        j = 0 -        continue -if Ans: +n = int(eval(input())) +a = list(map(int, input().split())) +judge = 0 +for i in range(n): +    if a[i] < judge: +        print("No") +        break +    judge = max(judge, a[i] - 1) +else: -else: -    print("No")