N = int(eval(input()))

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



flag = True



for i in range(N-1, 0, -1):

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

        H[i-1] -= 1

    elif H[i] < H[i-1] - 1:

        flag = False

        break

    elif H[i] >= H[i-1]:

        continue

        

if flag:

    print("Yes")

else:

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

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



flag = True



for i in range(N-1, 0, -1):

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

        continue

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

        H[i-1] -= 1

    elif H[i] < H[i-1] - 1:

        flag = False

        break

        

if flag:

    print("Yes")

else:

    print("No")
N = int(eval(input()))
H = list(map(int, input().split()))
flag = True
for i in range(N - 1, 0, -1):
    if H[i] == H[i - 1] - 1:
        H[i - 1] -= 1
    elif H[i] < H[i - 1] - 1:
        flag = False
        break
    elif H[i] >= H[i - 1]:
        continue
if flag:
    print("Yes")
else:
    print("No")

N = int(eval(input()))
H = list(map(int, input().split()))
flag = True
for i in range(N - 1, 0, -1):
    if H[i] >= H[i - 1]:
        continue
    elif H[i] == H[i - 1] - 1:
        H[i - 1] -= 1
    elif H[i] < H[i - 1] - 1:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

-    if H[i] == H[i - 1] - 1: +    if H[i] >= H[i - 1]: +        continue +    elif H[i] == H[i - 1] - 1: -    elif H[i] >= H[i - 1]: -        continue