import sys

input = sys.stdin.readline

import math

import collections

def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



n=I()

Hs=(LI())

if n==1:

    print("Yes")

    sys.exit()

for i in range(1,n):

    #print(Hs[-i])

    if Hs[-i-1]==Hs[-i]+1:

        Hs[-i-1]-=1

    elif Hs[-i-1]>Hs[-i]+1:

        print("No")

        sys.exit()

if i==n-1:

    print("Yes")
#float型を許すな

#numpyはpythonで

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10**7)

from collections import Counter, deque

from collections import defaultdict

from itertools import combinations, permutations, accumulate, groupby, product

from bisect import bisect_left,bisect_right

from heapq import heapify, heappop, heappush

from math import floor, ceil,pi,factorial

from operator import itemgetter

def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))

def LI2(): return [int(eval(input())) for i in range(n)]

def MXI(): return [[LI()]for i in range(n)]

def SI(): return input().rstrip()

def printns(x): print(('\n'.join(x)))

def printni(x): print(('\n'.join(list(map(str,x)))))

inf = 10**17

mod = 10**9 + 7



n=I()

lis=LI()

lis=list(reversed(lis))

st=lis[0]

for i in range(n-1):

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

        print("No")

        sys.exit()

    elif lis[i+1]==lis[i]+1:

        lis[i+1]-=1

    else:

        continue

print("Yes")
import sys

input = sys.stdin.readline
import math
import collections


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


n = I()
Hs = LI()
if n == 1:
    print("Yes")
    sys.exit()
for i in range(1, n):
    # print(Hs[-i])
    if Hs[-i - 1] == Hs[-i] + 1:
        Hs[-i - 1] -= 1
    elif Hs[-i - 1] > Hs[-i] + 1:
        print("No")
        sys.exit()
if i == n - 1:
    print("Yes")

# float型を許すな
# numpyはpythonで
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left, bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil, pi, factorial
from operator import itemgetter


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def LI2():
    return [int(eval(input())) for i in range(n)]


def MXI():
    return [[LI()] for i in range(n)]


def SI():
    return input().rstrip()


def printns(x):
    print(("\n".join(x)))


def printni(x):
    print(("\n".join(list(map(str, x)))))


inf = 10**17
mod = 10**9 + 7
n = I()
lis = LI()
lis = list(reversed(lis))
st = lis[0]
for i in range(n - 1):
    if lis[i + 1] > lis[i] + 1:
        print("No")
        sys.exit()
    elif lis[i + 1] == lis[i] + 1:
        lis[i + 1] -= 1
    else:
        continue
print("Yes")

+# float型を許すな +# numpyはpythonで -import math -import collections +sys.setrecursionlimit(10**7) +from collections import Counter, deque +from collections import defaultdict +from itertools import combinations, permutations, accumulate, groupby, product +from bisect import bisect_left, bisect_right +from heapq import heapify, heappop, heappush +from math import floor, ceil, pi, factorial +from operator import itemgetter +def LI2(): +    return [int(eval(input())) for i in range(n)] + + +def MXI(): +    return [[LI()] for i in range(n)] + + +def SI(): +    return input().rstrip() + + +def printns(x): +    print(("\n".join(x))) + + +def printni(x): +    print(("\n".join(list(map(str, x))))) + + +inf = 10**17 +mod = 10**9 + 7 -Hs = LI() -if n == 1: -    print("Yes") -    sys.exit() -for i in range(1, n): -    # print(Hs[-i]) -    if Hs[-i - 1] == Hs[-i] + 1: -        Hs[-i - 1] -= 1 -    elif Hs[-i - 1] > Hs[-i] + 1: +lis = LI() +lis = list(reversed(lis)) +st = lis[0] +for i in range(n - 1): +    if lis[i + 1] > lis[i] + 1: -if i == n - 1: -    print("Yes") +    elif lis[i + 1] == lis[i] + 1: +        lis[i + 1] -= 1 +    else: +        continue +print("Yes")