n = int(eval(input()))

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





w = 1

for i in range(n-1):

    if h[i] - h[i+1] >= 2:

        w = 0



for j in range(n-2):

    if h[j] - h[j+1]  == 1:

        for k in range(j,n-2):

            if h[k+1] - h[k+2] == 0:

                continue

            if h[k+1] - h[k+2] == 1:

                w = 0

                break

            break





        

if w == 0:

    print("No")

else:

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

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



answer = "Yes"

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

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

        answer = "No"

        break

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

        h[i] -= 1



print(answer)
n = int(eval(input()))
h = list(map(int, input().split()))
w = 1
for i in range(n - 1):
    if h[i] - h[i + 1] >= 2:
        w = 0
for j in range(n - 2):
    if h[j] - h[j + 1] == 1:
        for k in range(j, n - 2):
            if h[k + 1] - h[k + 2] == 0:
                continue
            if h[k + 1] - h[k + 2] == 1:
                w = 0
                break
            break
if w == 0:
    print("No")
else:
    print("Yes")

n = int(eval(input()))
h = list(map(int, input().split()))
answer = "Yes"
for i in range(n - 2, 0, -1):
    if h[i] > h[i + 1] + 1:
        answer = "No"
        break
    elif h[i] == h[i + 1] + 1:
        h[i] -= 1
print(answer)

-w = 1 -for i in range(n - 1): -    if h[i] - h[i + 1] >= 2: -        w = 0 -for j in range(n - 2): -    if h[j] - h[j + 1] == 1: -        for k in range(j, n - 2): -            if h[k + 1] - h[k + 2] == 0: -                continue -            if h[k + 1] - h[k + 2] == 1: -                w = 0 -                break -            break -if w == 0: -    print("No") -else: -    print("Yes") +answer = "Yes" +for i in range(n - 2, 0, -1): +    if h[i] > h[i + 1] + 1: +        answer = "No" +        break +    elif h[i] == h[i + 1] + 1: +        h[i] -= 1 +print(answer)