N = int(eval(input()))



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

flg = False

for i in range(1,N+1):

    if flg:

        tmp = H[-i]-1

    else:

        tmp = H[-i]

    flg = False

    if not i==N:

        if tmp < H[-i-1]:

            if tmp == H[-i-1]-1:

                flg = True

            else:

                print('No')

                exit()

print('Yes')
N = int(eval(input()))



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

for i in range(1,N+1):

    tmp = H[-i]

    if not i==N:

        if tmp < H[-i-1]:

            if tmp == H[-i-1]-1:

                H[-i-1] -= 1

            else:

                print('No')

                exit()

print('Yes')

N = int(eval(input()))
H = list(map(int, input().split()))
flg = False
for i in range(1, N + 1):
    if flg:
        tmp = H[-i] - 1
    else:
        tmp = H[-i]
    flg = False
    if not i == N:
        if tmp < H[-i - 1]:
            if tmp == H[-i - 1] - 1:
                flg = True
            else:
                print("No")
                exit()
print("Yes")

N = int(eval(input()))
H = list(map(int, input().split()))
for i in range(1, N + 1):
    tmp = H[-i]
    if not i == N:
        if tmp < H[-i - 1]:
            if tmp == H[-i - 1] - 1:
                H[-i - 1] -= 1
            else:
                print("No")
                exit()
print("Yes")

-flg = False -    if flg: -        tmp = H[-i] - 1 -    else: -        tmp = H[-i] -    flg = False +    tmp = H[-i] -                flg = True +                H[-i - 1] -= 1