# ABC136C - Build Stairs

def main():

    n = int(eval(input()))

    A = tuple(map(int, input().rstrip().split()))

    cur = A[0]

    for i in A[1:]:

        if i == cur or i - 1 == cur:

            continue

        elif i > cur:

            cur = i - 1

        else:

            print("No")

            break

    else:

        print("Yes")





if __name__ == "__main__":

    main()
# ABC136C - Build Stairs

def main():

    n = int(eval(input()))

    A = tuple(map(int, input().rstrip().split()))

    cur = A[0]

    for i in A[1:]:

        if i > cur + 1:

            cur = i - 1

        if i < cur:

            print("No")

            break

    else:

        print("Yes")





if __name__ == "__main__":

    main()
# ABC136C - Build Stairs
def main():
    n = int(eval(input()))
    A = tuple(map(int, input().rstrip().split()))
    cur = A[0]
    for i in A[1:]:
        if i == cur or i - 1 == cur:
            continue
        elif i > cur:
            cur = i - 1
        else:
            print("No")
            break
    else:
        print("Yes")


if __name__ == "__main__":
    main()

# ABC136C - Build Stairs
def main():
    n = int(eval(input()))
    A = tuple(map(int, input().rstrip().split()))
    cur = A[0]
    for i in A[1:]:
        if i > cur + 1:
            cur = i - 1
        if i < cur:
            print("No")
            break
    else:
        print("Yes")


if __name__ == "__main__":
    main()

-        if i == cur or i - 1 == cur: -            continue -        elif i > cur: +        if i > cur + 1: -        else: +        if i < cur: