import sys

import numpy as np

input = sys.stdin.readline

n = int(eval(input()))



L = np.array(list(map(int, input().split())))



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

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

        L[i-1] -=1



if np.all(L ==sorted(L)):

    print('Yes')

else:

    print('No')
import sys

n, hl = sys.stdin.readlines()

n = int(n)

hl = list(map(int, hl.split()))



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

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

        hl[i-1]-=1



if hl == sorted(hl):

    print('Yes')

else:

    print('No')
import sys
import numpy as np

input = sys.stdin.readline
n = int(eval(input()))
L = np.array(list(map(int, input().split())))
for i in range(n - 1, 0, -1):
    if L[i] - L[i - 1] == -1:
        L[i - 1] -= 1
if np.all(L == sorted(L)):
    print("Yes")
else:
    print("No")

import sys

n, hl = sys.stdin.readlines()
n = int(n)
hl = list(map(int, hl.split()))
for i in range(n - 1, 0, -1):
    if hl[i] - hl[i - 1] == -1:
        hl[i - 1] -= 1
if hl == sorted(hl):
    print("Yes")
else:
    print("No")

-import numpy as np -input = sys.stdin.readline -n = int(eval(input())) -L = np.array(list(map(int, input().split()))) +n, hl = sys.stdin.readlines() +n = int(n) +hl = list(map(int, hl.split())) -    if L[i] - L[i - 1] == -1: -        L[i - 1] -= 1 -if np.all(L == sorted(L)): +    if hl[i] - hl[i - 1] == -1: +        hl[i - 1] -= 1 +if hl == sorted(hl):