N, *H = list(map(int, open(0).read().split()))

cnt = 0

for i in range(N - 1):

    if H[i + 1] - H[i] < -1:

        print('No')

        break

    elif H[i + 1] - H[i] == -1:

        cnt += 1

    elif H[i + 1] - H[i] == 0:

        pass

    else:

        cnt = 0

        

    if cnt > 1:

        print('No')

        break

else:

    print('Yes')



N = int(eval(input()))

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



cur = 0

flag = True

for i in range(N):

    cur = max(cur, X[i])

    if cur - X[i] > 1:

        flag = False



if flag:

    print("Yes")

else:

    print("No")

N, *H = list(map(int, open(0).read().split()))
cnt = 0
for i in range(N - 1):
    if H[i + 1] - H[i] < -1:
        print("No")
        break
    elif H[i + 1] - H[i] == -1:
        cnt += 1
    elif H[i + 1] - H[i] == 0:
        pass
    else:
        cnt = 0
    if cnt > 1:
        print("No")
        break
else:
    print("Yes")

N = int(eval(input()))
X = list(map(int, input().split()))
cur = 0
flag = True
for i in range(N):
    cur = max(cur, X[i])
    if cur - X[i] > 1:
        flag = False
if flag:
    print("Yes")
else:
    print("No")

-N, *H = list(map(int, open(0).read().split())) -cnt = 0 -for i in range(N - 1): -    if H[i + 1] - H[i] < -1: -        print("No") -        break -    elif H[i + 1] - H[i] == -1: -        cnt += 1 -    elif H[i + 1] - H[i] == 0: -        pass -    else: -        cnt = 0 -    if cnt > 1: -        print("No") -        break +N = int(eval(input())) +X = list(map(int, input().split())) +cur = 0 +flag = True +for i in range(N): +    cur = max(cur, X[i]) +    if cur - X[i] > 1: +        flag = False +if flag: +    print("Yes") -    print("Yes") +    print("No")