N = int(eval(input()))

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



for i in reversed(list(range(1, N))):

    if H[i] >= H[i-1]: continue

    elif H[i] == H[i-1] - 1: H[i-1] -= 1

    else:

        print("No")

        break

else: print("Yes")

import sys



def solve():

    input = sys.stdin.readline

    N = int(eval(input()))

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

    for i in reversed(list(range(N-1))):

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

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

            print("No")

            break

    else: print("Yes")



    return 0



if __name__ == "__main__":

    solve()
N = int(eval(input()))
H = [int(h) for h in input().split()]
for i in reversed(list(range(1, N))):
    if H[i] >= H[i - 1]:
        continue
    elif H[i] == H[i - 1] - 1:
        H[i - 1] -= 1
    else:
        print("No")
        break
else:
    print("Yes")

import sys


def solve():
    input = sys.stdin.readline
    N = int(eval(input()))
    H = [int(h) for h in input().split()]
    for i in reversed(list(range(N - 1))):
        if H[i] > H[i + 1]:
            H[i] -= 1
        if H[i] > H[i + 1]:
            print("No")
            break
    else:
        print("Yes")
    return 0


if __name__ == "__main__":
    solve()

-N = int(eval(input())) -H = [int(h) for h in input().split()] -for i in reversed(list(range(1, N))): -    if H[i] >= H[i - 1]: -        continue -    elif H[i] == H[i - 1] - 1: -        H[i - 1] -= 1 +import sys + + +def solve(): +    input = sys.stdin.readline +    N = int(eval(input())) +    H = [int(h) for h in input().split()] +    for i in reversed(list(range(N - 1))): +        if H[i] > H[i + 1]: +            H[i] -= 1 +        if H[i] > H[i + 1]: +            print("No") +            break -        print("No") -        break -else: -    print("Yes") +        print("Yes") +    return 0 + + +if __name__ == "__main__": +    solve()