n = int(eval(input()))

h = [int(i) for i in input().split()]

x = True

c = 0

for i in range(n):

    if i > 0 and h[i - 1] - h[i] >= 2:

        x = False

        break

    elif i > 0 and h[i - 1] - h[i] == 1:

        c += 1

    elif i > 0 and h[i] > h[i - 1] and c == 1:

        c = 0

    if c == 2:

        x = False

        break

if x:

    print("Yes")

else:

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

h = [int(i) for i in input().split()]

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

    d = h[i - 1] - h[i]

    if d > 1:

        print("No")

        break

    if d == 1:

        h[i - 1] -= 1

else:

    print("Yes")
n = int(eval(input()))
h = [int(i) for i in input().split()]
x = True
c = 0
for i in range(n):
    if i > 0 and h[i - 1] - h[i] >= 2:
        x = False
        break
    elif i > 0 and h[i - 1] - h[i] == 1:
        c += 1
    elif i > 0 and h[i] > h[i - 1] and c == 1:
        c = 0
    if c == 2:
        x = False
        break
if x:
    print("Yes")
else:
    print("No")

n = int(eval(input()))
h = [int(i) for i in input().split()]
for i in range(n - 1, 0, -1):
    d = h[i - 1] - h[i]
    if d > 1:
        print("No")
        break
    if d == 1:
        h[i - 1] -= 1
else:
    print("Yes")

-x = True -c = 0 -for i in range(n): -    if i > 0 and h[i - 1] - h[i] >= 2: -        x = False +for i in range(n - 1, 0, -1): +    d = h[i - 1] - h[i] +    if d > 1: +        print("No") -    elif i > 0 and h[i - 1] - h[i] == 1: -        c += 1 -    elif i > 0 and h[i] > h[i - 1] and c == 1: -        c = 0 -    if c == 2: -        x = False -        break -if x: +    if d == 1: +        h[i - 1] -= 1 +else: -else: -    print("No")