def solve(N, H):

    max_h = 0

    ret = True

    for h in H:

        if max_h-h >= 2:

            ret = False

            break

        max_h = max(max_h, h)

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



N = int(eval(input()))

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



solve(N,H)
def solve():

    N = int(eval(input()))

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

    h_max = H[0]

    ret = True

    for h in H:

        if h_max-1 > h:

            ret = False

            break

        if h_max < h:

            h_max = h

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

    

solve()
def solve(N, H):
    max_h = 0
    ret = True
    for h in H:
        if max_h - h >= 2:
            ret = False
            break
        max_h = max(max_h, h)
    print(("Yes" if ret else "No"))


N = int(eval(input()))
H = list(map(int, input().split()))
solve(N, H)

def solve():
    N = int(eval(input()))
    H = list(map(int, input().split()))
    h_max = H[0]
    ret = True
    for h in H:
        if h_max - 1 > h:
            ret = False
            break
        if h_max < h:
            h_max = h
    print(("Yes" if ret else "No"))


solve()

-def solve(N, H): -    max_h = 0 +def solve(): +    N = int(eval(input())) +    H = list(map(int, input().split())) +    h_max = H[0] -        if max_h - h >= 2: +        if h_max - 1 > h: -        max_h = max(max_h, h) +        if h_max < h: +            h_max = h -N = int(eval(input())) -H = list(map(int, input().split())) -solve(N, H) +solve()