# -*- coding: utf-8 -*-

n = int(eval(input()))

h = [int(i) for i in input().split()]



flag = True

for i in reversed(list(range(n - 1))):

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

        h[i] -= 1

    elif h[i] > h[i + 1]:

        flag = False

if flag:

    print("Yes")

else:

    print("No")

# -*- coding: utf-8 -*-

n = int(eval(input()))

h = [int(i) for i in input().split()]



flag = True

for i in reversed(list(range(n - 1))):

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

        h[i] -= 1

    elif h[i] > h[i + 1]:

        flag = False

        break

if flag:

    print("Yes")

else:

    print("No")

# -*- coding: utf-8 -*-
n = int(eval(input()))
h = [int(i) for i in input().split()]
flag = True
for i in reversed(list(range(n - 1))):
    if h[i] - h[i + 1] == 1:
        h[i] -= 1
    elif h[i] > h[i + 1]:
        flag = False
if flag:
    print("Yes")
else:
    print("No")

# -*- coding: utf-8 -*-
n = int(eval(input()))
h = [int(i) for i in input().split()]
flag = True
for i in reversed(list(range(n - 1))):
    if h[i] - h[i + 1] == 1:
        h[i] -= 1
    elif h[i] > h[i + 1]:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

+        break