#!/usr/bin/env python

# coding: utf-8



def ri():

    return int(eval(input()))



def rl():

    return list(input().split())



def rli():

    return list(map(int, input().split()))



def main():

    n = ri()

    lh = rli()

    for i in range(len(lh)-1):

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

            lh[i+1] -= 1

        if lh[i+1] < lh[i]:

            print("No")

            return

    print("Yes")





if __name__ == '__main__':

    main()

#!/usr/bin/env python

# coding: utf-8



def ri():

    return int(eval(input()))



def rl():

    return list(input().split())



def rli():

    return list(map(int, input().split()))



def main():

    n = ri()

    lh = rli()

    c = 0

    for h in lh:

        # print(c, h)

        if h < c:

            print("No")

            return

        elif h == c:

            c = h

        else:

            c = h-1

    print("Yes")





if __name__ == '__main__':

    main()

#!/usr/bin/env python
# coding: utf-8
def ri():
    return int(eval(input()))


def rl():
    return list(input().split())


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


def main():
    n = ri()
    lh = rli()
    for i in range(len(lh) - 1):
        if lh[i + 1] > lh[i]:
            lh[i + 1] -= 1
        if lh[i + 1] < lh[i]:
            print("No")
            return
    print("Yes")


if __name__ == "__main__":
    main()

#!/usr/bin/env python
# coding: utf-8
def ri():
    return int(eval(input()))


def rl():
    return list(input().split())


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


def main():
    n = ri()
    lh = rli()
    c = 0
    for h in lh:
        # print(c, h)
        if h < c:
            print("No")
            return
        elif h == c:
            c = h
        else:
            c = h - 1
    print("Yes")


if __name__ == "__main__":
    main()

-    for i in range(len(lh) - 1): -        if lh[i + 1] > lh[i]: -            lh[i + 1] -= 1 -        if lh[i + 1] < lh[i]: +    c = 0 +    for h in lh: +        # print(c, h) +        if h < c: +        elif h == c: +            c = h +        else: +            c = h - 1