N = int(eval(input()))

H = [int(x) for x in input().split()]



prev = -1

is_possible = "Yes"

for i in range(N):

    if prev < H[i]:

        H[i] -= 1

    if prev > H[i]:

        is_possible = "No"

        break

    prev = H[i]



print(is_possible)

def main():



    N = int(eval(input()))

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

    prev = float('-inf')

    for i in range(len(H)):

        if H[i] > prev: prev = H[i]-1

        elif H[i] == prev: pass

        else: return "No"



    return "Yes"



if __name__ == '__main__':

    print((main()))
N = int(eval(input()))
H = [int(x) for x in input().split()]
prev = -1
is_possible = "Yes"
for i in range(N):
    if prev < H[i]:
        H[i] -= 1
    if prev > H[i]:
        is_possible = "No"
        break
    prev = H[i]
print(is_possible)

def main():
    N = int(eval(input()))
    H = list(map(int, input().split()))
    prev = float("-inf")
    for i in range(len(H)):
        if H[i] > prev:
            prev = H[i] - 1
        elif H[i] == prev:
            pass
        else:
            return "No"
    return "Yes"


if __name__ == "__main__":
    print((main()))

-N = int(eval(input())) -H = [int(x) for x in input().split()] -prev = -1 -is_possible = "Yes" -for i in range(N): -    if prev < H[i]: -        H[i] -= 1 -    if prev > H[i]: -        is_possible = "No" -        break -    prev = H[i] -print(is_possible) +def main(): +    N = int(eval(input())) +    H = list(map(int, input().split())) +    prev = float("-inf") +    for i in range(len(H)): +        if H[i] > prev: +            prev = H[i] - 1 +        elif H[i] == prev: +            pass +        else: +            return "No" +    return "Yes" + + +if __name__ == "__main__": +    print((main()))