# import sys

# sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

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



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

def MI1(): return list(map(int1, input().split()))



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

def LLI(rows_number): return [LI() for _ in range(rows_number)]



from collections import deque



def solve():

    n = II()

    H = LI()

    d = deque([])



    flag = True

    for i in range(0, n):

        hi = H[i]

        if i == 0:

            d.append(hi - 1)

            continue



        hp = d.popleft()

        if hp < hi:

            d.append(hi - 1)

        elif hp == hi:

            d.append(hi)

        else:   # hp > hi

            flag = False

            break



    print(('Yes' if flag else 'No'))















if __name__ == '__main__':

    solve()

# import sys

# sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

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



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

def MI1(): return list(map(int1, input().split()))



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

def LLI(rows_number): return [LI() for _ in range(rows_number)]





def solve():

    n = II()

    H = LI()



    pre = -999

    flag = True

    for h in H:

        if pre <= h - 1:

            pre = h - 1

        elif pre <= h:

            pre = h

        else:

            flag = False

            break



    print(('Yes' if flag else 'No'))



if __name__ == '__main__':

    solve()

# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1


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


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


def MI1():
    return list(map(int1, input().split()))


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


def LLI(rows_number):
    return [LI() for _ in range(rows_number)]


from collections import deque


def solve():
    n = II()
    H = LI()
    d = deque([])
    flag = True
    for i in range(0, n):
        hi = H[i]
        if i == 0:
            d.append(hi - 1)
            continue
        hp = d.popleft()
        if hp < hi:
            d.append(hi - 1)
        elif hp == hi:
            d.append(hi)
        else:  # hp > hi
            flag = False
            break
    print(("Yes" if flag else "No"))


if __name__ == "__main__":
    solve()

# import sys
# sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1


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


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


def MI1():
    return list(map(int1, input().split()))


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


def LLI(rows_number):
    return [LI() for _ in range(rows_number)]


def solve():
    n = II()
    H = LI()
    pre = -999
    flag = True
    for h in H:
        if pre <= h - 1:
            pre = h - 1
        elif pre <= h:
            pre = h
        else:
            flag = False
            break
    print(("Yes" if flag else "No"))


if __name__ == "__main__":
    solve()

-from collections import deque - - -    d = deque([]) +    pre = -999 -    for i in range(0, n): -        hi = H[i] -        if i == 0: -            d.append(hi - 1) -            continue -        hp = d.popleft() -        if hp < hi: -            d.append(hi - 1) -        elif hp == hi: -            d.append(hi) -        else:  # hp > hi +    for h in H: +        if pre <= h - 1: +            pre = h - 1 +        elif pre <= h: +            pre = h +        else: