n = int(eval(input()))

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

ans = "Yes"



for i in range(1, n):

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

        h[i] -= 1



if h == sorted(h):

    print("Yes")

else:

    print("No")

import sys



sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7





def resolve():

    n = int(eval(input()))

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



    for i in range(1, n):

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

            H[i] -= 1



    for j in range(1, n):

        if H[j - 1] > H[j]:

            print("No")

            break

    else:

        print("Yes")





if __name__ == '__main__':

    resolve()

n = int(eval(input()))
h = list(map(int, input().split()))
ans = "Yes"
for i in range(1, n):
    if h[i] > h[i - 1]:
        h[i] -= 1
if h == sorted(h):
    print("Yes")
else:
    print("No")

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7


def resolve():
    n = int(eval(input()))
    H = list(map(int, input().split()))
    for i in range(1, n):
        if H[i - 1] < H[i]:
            H[i] -= 1
    for j in range(1, n):
        if H[j - 1] > H[j]:
            print("No")
            break
    else:
        print("Yes")


if __name__ == "__main__":
    resolve()

-n = int(eval(input())) -h = list(map(int, input().split())) -ans = "Yes" -for i in range(1, n): -    if h[i] > h[i - 1]: -        h[i] -= 1 -if h == sorted(h): -    print("Yes") -else: -    print("No") +import sys + +sys.setrecursionlimit(10**7) +f_inf = float("inf") +mod = 10**9 + 7 + + +def resolve(): +    n = int(eval(input())) +    H = list(map(int, input().split())) +    for i in range(1, n): +        if H[i - 1] < H[i]: +            H[i] -= 1 +    for j in range(1, n): +        if H[j - 1] > H[j]: +            print("No") +            break +    else: +        print("Yes") + + +if __name__ == "__main__": +    resolve()