import sys

n = int(eval(input()))

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

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

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

    h[i] -= 1

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

    print('No')

    sys.exit()

print('Yes')

from sys import exit



N = int(eval(input()))

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



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

    if H[i] <= H[i + 1]:

        continue

    H[i] -= 1

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

        print('No')

        exit()

print('Yes')

import sys

n = int(eval(input()))
h = [int(e) for e in input().split()]
for i in range(n - 2, 0, -1):
    if h[i] > h[i + 1]:
        h[i] -= 1
    if h[i] > h[i + 1]:
        print("No")
        sys.exit()
print("Yes")

from sys import exit

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

-import sys +from sys import exit -n = int(eval(input())) -h = [int(e) for e in input().split()] -for i in range(n - 2, 0, -1): -    if h[i] > h[i + 1]: -        h[i] -= 1 -    if h[i] > h[i + 1]: +N = int(eval(input())) +H = list(map(int, input().split())) +for i in range(N - 2, 0, -1): +    if H[i] <= H[i + 1]: +        continue +    H[i] -= 1 +    if H[i] > H[i + 1]: -        sys.exit() +        exit()