import sys

N = int(eval(input()))

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



m = 0

for h in H:

    if m <= h-1 or m-1 <= h:

        m = max(m, h)

    else:

        print("No")

        sys.exit()



print("Yes")

        
import sys

N = int(eval(input()))

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



m = 0

for h in H:

    if m-1 <= h:

        m = max(m, h)

    else:

        print("No")

        sys.exit()



print("Yes")

        
import sys

N = int(eval(input()))
H = list(map(int, input().split()))
m = 0
for h in H:
    if m <= h - 1 or m - 1 <= h:
        m = max(m, h)
    else:
        print("No")
        sys.exit()
print("Yes")

import sys

N = int(eval(input()))
H = list(map(int, input().split()))
m = 0
for h in H:
    if m - 1 <= h:
        m = max(m, h)
    else:
        print("No")
        sys.exit()
print("Yes")

-    if m <= h - 1 or m - 1 <= h: +    if m - 1 <= h: