peterverebics/CodeNet_Python_118 huggingface dataset:
N = int(input())
H = list(map(int, input().split()))

ans = 'Yes'
_max = 0
for i in H:
    if _max < i - 1:
        _max = i - 1
    if _max > i:
        ans = 'No'
print(ans)
n,*l=map(int,open(0).read().split())
t=0
for i in l:
  if i<t: print('No'); break
  if i>t: i-=1
  t=i
else: print('Yes')
def solve():
    N = int(input())
    H = list(map(int, input().split()))
    h_max = H[0]
    ret = True
    for h in H:
        if h_max-1 > h:
            ret = False
            break
        if h_max < h:
            h_max = h
    print('Yes' if ret else 'No')
    
solve()
n=int(input())
h=list(map(int, input().split()))
c=0
if n!=1:
    for i in reversed(range(n-1)):
        if h[i]==h[i+1]+1:
            h[i]-=1
        elif h[i]-h[i+1]>=2:
            c=1
    if c==0:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")
N = int(input())
H = list(map(int,input().split()))
for i in range(N-1,0,-1):
    if H[i] < H[i-1]:
        H[i-1] = H[i-1]-1
        if H[i] < H[i-1]:
            print("No")
            exit()
print("Yes")
N = int(input())
H = list(map(int, input().split()))
max_h = H[0]
flag = 0

for i in range(1, N):
    max_h = max(max_h, H[i])
    if max_h - H[i] > 1:
        flag += 1

if flag:
    print('No')
else:
    print('Yes')
N = int(input())
H = list(map(int, input().split()))

ans = 'Yes'
H_floor = 0
for h in H:
    if h - H_floor < 0:
        ans = 'No'
        break
    else:
        H_floor = max(H_floor, h - 1) 
        
print(ans)
n = int(input())
h = list(map(int,input().split()))

tmp = h[0] - 1
for i in range(1,n):
    if tmp == h[i]:
        tmp = h[i]
    elif tmp < h[i]:
        tmp = h[i] - 1
    else:
        print('No')
        exit()
print("Yes")
#!/usr/bin/env python3
def solve(a):
    for i in range(len(a)-1):
        if a[i+1] - a[i] <= -2:
            return "No"
        elif a[i+1] - a[i] == -1:
            a[i+1] += 1
    return "Yes"

def main():
    N = int(input())
    A = [0] + list(map(int,input().split()))
    print(solve(A))

if __name__ == '__main__':
    main()
N = int(input())
H = list(map(int, input().split()))

base = 0
for h in H:
    if(base > h):
        print("No")
        break
    base = max(base, h-1)
else:
    print("Yes")
import sys
N=int(input())

H=[int(x) for x in input().rstrip().split()]
flag=0
mi=-1
for i in range(N-1):

  if H[i]<=H[i+1] and mi<=H[i]:
    mi=max(mi,H[i]-1)
    continue
  elif H[i+1]<H[i]:
    H[i]=H[i]-1
    mi=max(mi,H[i])
  if H[i+1]<H[i] or H[i]<mi:
    flag=1
    print("No")
    sys.exit()

if flag==0:
  print("Yes")
N = int(input())
H = list(map(int, input().split()))

ans = 'Yes'
for i in range(1, N):
  if H[N-i-1]-1 == H[N-i]:
    H[N-i-1] -= 1
  elif H[N-i-1]-1 > H[N-i]:
    ans = 'No'
    break
    
print(ans)
def resolve():

    n=int(input())
    H=list(map(int,input().split()))
    def main():
        if n == 1:
            return 'Yes'
        maxval=0
        for i in range(n):
            if maxval-2>=H[i]:
                return 'No'
            else:
                maxval=max(maxval,H[i])
        return 'Yes'
    print(main())


resolve()
n=int(input())
h=list(map(int,input().split()))
ans="Yes"
FL=False
Fx=-1
for i in range(n-1):
  if n==1:
    break
  if h[i]>=Fx:
    FL=False 
  if h[i]-h[i+1]==1:
    if FL:
      ans="No"
      break  
    else:
      FL=True
      Fx=h[i]
  elif h[i]-h[i+1]>1:
    ans="No"
    break  
    
print(ans)
from sys import exit
n=int(input())
H=list(map(int,input().split()))
H[0] -= 1
for i in range(n-1):
	if H[i]>H[i+1]:
		print("No")
		exit()
	elif H[i]!=H[i+1]:
		H[i+1] -= 1
print("Yes")
import math
import os
import random
import re
import sys

def check_non_decreasing_squares(n: int, a: list):
    p = a[0]
    for i in range(1, n):
        if a[i] > p:
            p = a[i]
        if p - a[i] == 1 or p - a[i] == 0:
            continue
        print("No")
        exit(0)
    print("Yes")

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().rstrip().split()))
    check_non_decreasing_squares(n, a)
n = int(input())
h_list = [int(x) for x in input().split()]

ans = "Yes"
h_pre = h_list[0]
for h in h_list:
    if h > h_pre:
        h -= 1
    elif h < h_pre:
        ans = "No"
        break
    h_pre = h
print(ans)
N = int(input())
A = list(map(int,input().split()))
flag = 0
for i in range(N-1,0,-1):
  if A[i] >= A[i-1]:
    continue
  else:
    if A[i-1]-A[i] == 1:
      A[i-1] -= 1
    else:
      flag += 1
      print("No")
      break
if flag == 0:
  print("Yes")
N = int(input())
H = list(map(int, input().split()))
ans = "Yes"
H[0] = H[0] - 1
base = 0
for i in range(1, N):
    if H[i] > H[i-1] :
        H[i] = H[i] -1
    elif H[i] < H[i-1] :
        ans = "No"
print(ans)
N = int(input())
H = list(map(int, input().split()))
border = H[N-1]

ans = True
for i in range(N-2, -1, -1):
    if H[i] <= border:
        border = H[i]
    else:
        if H[i] - 1 <= border:
            border = H[i] - 1
        else:
            ans = False

if ans:
    print("Yes")
else:
    print("No")
n = int(input())
klist = list(map(int,input().split()))
hlist = klist[::-1]
for i in range(n-1):
  if hlist[i]+1 < hlist[i+1]:
    print('No')
    break

  if hlist[i]+1 == hlist[i+1]:
    hlist[i+1] -= 1
else:print('Yes')
#<C>
N = int(input())
H = list(map(int, input().split()))
ans = 0
for n in range(N):
    if ans - 1 > H[n]:
        print("No")
        exit()
    ans = max(ans,H[n])
print("Yes")
def main():
    N = int(input())
    A = list(map(int,input().split()))
    pre = A[0]
    for i in A:
        if pre > i:
            print("No")
            return
        elif pre < i:
            pre = i -1
    print("Yes")        
if __name__ == "__main__":
    main()
N = int(input())
h = list(map(int, input().split()))
ans = True
MIN = h[0]-1

for i in range(N-1):
    MIN = max(MIN, h[i]-1)
    if h[i] > h[i+1]:
        if h[i]-h[i+1] > 1:
            ans = False
            break
        else:
            if MIN > h[i+1]:
                ans = False
                break

if ans:
    print('Yes')
else:
    print('No')
n = int(input())
h = list(map(int, input().split()))

N=h[0]
for i in range(n):
    if N-1 > h[i]:
        print("No")
        break
    elif h[i] > N:
        N = h[i]
        
else:
    print("Yes")
n = int(input())
H = list(map(int,input().split()))

ans = "Yes"
c=0
for i in range(n-1):
    if H[i]-1>H[i+1] :
        ans = "No"
        break
    elif H[i]>H[i+1] :
        c+=1
        if c>=2 :
            ans = "No"
            break
    elif H[i]<H[i+1] :
        c=0
print(ans)
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
count = 0
for i in range(1, n):
    if h[i]-h[i-1]==1:
        h[i]+=-1
    elif h[i]-h[i-1]>=2:
        print('No')
        exit()
print('Yes')
import sys
#import numpy as np
import math
from fractions import Fraction
import itertools

input=sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))
s=set()
for i in range(n-1):
    if a[n-1-i-1]>1+a[n-i-1]:
        print("No")
        exit()
    elif a[n-i-2]==a[n-i-1]+1:
        a[n-i-2]-=1
        s.add(i)
for i in range(n-1):
    if a[i]>a[i+1] and i in s:
        print("No")
        exit()
print("Yes")
N = int(input())
H = list(int(x) for x in input().split())
max = H[0]
ans = True

for i in range(N):
    if max < H[i]:
        max = H[i]
    elif max - 2 >= H[i]:
        ans = False
        break

if ans:
    print('Yes')
else:
    print('No')
N = int(input())
H = list(map(int, input().split()))

f = True
H[0] -= 1
for i in range(1, N):
  if H[i - 1] > H[i]:
    f = False
    break
  elif H[i - 1] < H[i]:
    H[i] -= 1

print("Yes" if f else "No")
n = int(input())
lis = list(map(int,input().split()))
lis[0]-=1
for i in range(n-1):
  if lis[i] < lis[i+1]:
    lis[i+1] -= 1
  elif lis[i] > lis[i+1]:
    print("No")
    exit()
print("Yes")
n = int(input())
nums = list(map(int,input().split()))
tall = 0
for i in nums:
    if tall - i >=2:
        print('No')
        exit()
    tall = max(tall,i)
print('Yes')
N = int(input())
H = list(map(int, input().split()))

prev = H[0]
flag = True
for i in range(N-1):
    now = H[-i-1]
    after = H[-i-2]
    if after - now > 1:
        flag = False
        break
    elif after - now == 1:
        H[-i-2] -= 1
    else:
        pass
print('Yes') if flag else print('No')
n = int(input())
h = list(map(int,input().split()))
bh = h[0]


for i in range(1,n):
    if bh>h[i]:
        print("No")
        exit()
    elif h[i]>bh:
        bh = h[i]-1
    else:
        bh = h[i]

print("Yes")
n=int(input())
h=[int(x) for x in input().split()]
a=1
for i in range(n-1):
  if h[i]>h[i+1]:
    h[i+1]+=1
    if h[i]>h[i+1]:
      print("No")
      a=0
      break
if a==1:
  print("Yes")
N = int(input())
H = list(map(int, input().split()))

for i in range(len(H)-2, -1, -1):
    if H[i] - H[i+1] == 1:
        H[i] -= 1
    elif  H[i] - H[i+1] >= 2:
        print("No")
        exit()
    else:
        continue

print("Yes")
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1,0,-1):
    if H[i] - H[i-1] == -1:
        H[i-1] -= 1

for j in range(N-1):
    if H[j] > H[j+1]:
        print('No')
        break
else:
    print('Yes')
N = int(input())
h = list(map(int, input().split()))

for i in range(1, N):
    if h[i] - h[i - 1] >= 1:
        h[i] -= 1

for i in range(1, N):
    if h[i] - h[i - 1] < 0:
        print('No')
        exit()

print('Yes')
n=int(input())
h=list(map(int,input().split()))
for i in range(n-2,-1,-1):
    if h[i]>h[i+1]:
        h[i]-=1
for i in range(n-1):
    if h[i]>h[i+1]:
        print("No")
        exit()
print("Yes")
n = int(input())
h = list(map(int,input().split()))
tmp = h[0]
isOK = True
for i in range(1,n):
    #print(tmp,h[i])
    if tmp < h[i]:
        tmp = h[i] - 1
    elif tmp == h[i]:
        tmp = h[i]
    else:
        isOK = False
        break
if isOK:
    print('Yes')
else:
    print('No')
n = int(input())
h = [int(i) for i in input().split()]
x = True
c = 0
for i in range(n):
    if i > 0 and h[i - 1] - h[i] >= 2:
        x = False
        break
    elif i > 0 and h[i - 1] - h[i] == 1:
        c += 1
    elif i > 0 and h[i] > h[i - 1] and c == 1:
        c = 0
    if c == 2:
        x = False
        break
if x:
    print("Yes")
else:
    print("No")
n = int(input())
h = list(map(int,input().split()))
flag = True
for i in range(n-1):
    if h[i+1] - h[i] >= 1:
        h[i+1] -= 1
    elif h[i+1] -h[i] == 0:
        pass
    else:
        flag = False
        break
if flag:
    print('Yes')
else:
    print('No')
n=int(input())
li=list(map(int, input().split()))
ans="Yes"
h=li[0]
for i in range(1,n):
    if h-li[i]>=2:
        ans="No"
        break
    h=max(h,li[i])
print(ans)
#136c
N = int(input())
H_list = [int(e) for e in input().split()]

H_list[0] -= 1 #最初の奴は減らしても影響なし。

for i in range(1,N):
    #print(H_list)
    #print(H_list[i-1],H_list[i])
    
    if H_list[i-1] < H_list[i]:
        H_list[i] -= 1
    
    if H_list[i-1] > H_list[i]:
        print("No")
        break
else:
    print("Yes")
N = int(input())
H = list(map(int, input().split()))
H.reverse()
def main():
  for i in range(N-1):
    if (H[i+1] - H[i] >= 2):
      print("No")
      return
    if (H[i+1] - H[i] == 1):
      H[i+1] -= 1
  print("Yes")

main()
n=int(input())
arr=list(map(int,input().split()))
for i in range(n-2,-1,-1):
  if arr[i]>arr[i+1]:
    arr[i]-=1
    if arr[i]>arr[i+1]:
      print('No')
      break
else:
  print('Yes')
N = int(input())
H = list(map(int, input().split()))

for i in range(1, N):
    if H[i] - H[i - 1] > 0:
        H[i] -= 1
    if H[i] - H[i - 1] < 0:
        print("No")
        break
else:
    print("Yes")
n= int(input())
if n==1:
  print('Yes')
  exit()
h=list(map(int,input().split()))
ans='Yes'
for i in range(n-1):
  if h[i+1]>h[i]:
    h[i+1]-=1
  elif h[i+1]<h[i]:
    print('No')
    exit()
print(ans)
n = int(input())
h = list(map(int, input().split()))

memo = 0
for i in range(n-1):
  if h[i] > h[i+1]:
    memo = max(memo, h[i] - 1)
    if h[i] - h[i+1] > 2 or h[i+1] < memo:
      print("No")
      exit()
print("Yes")
N = int(input())
H = list(map(int, input().split()))
h = H[-1]
ans = "Yes"
for i in range(N-1, -1, -1):
  if H[i] <= h+1:
    h = min(h, H[i])
  else:
    ans = "No"
    break
print(ans)
N = int(input())
hh = list(map(int, input().split()))

for i in range(1, N):
    if hh[i - 1] == hh[i]:
        continue
    else:
        hh[i] -= 1
    if hh[i - 1] > hh[i]:
        print("No")
        exit()

print("Yes")
N=int(input())
H=list(map(int,input().split()))
base=0
for h in H:
    if base>h:
        print("No")
        break
    base=max(base,h-1)
else:
    print("Yes")
n = int(input())
H = list(map(int,input().split()))

for i in range(1,n-1):
    if H[n-1-i] == H[n-i] + 1:
        H[n-1-i] -= 1
    elif not(H[n-1-i] == H[n-i] or H[n-1-i] < H[n-i]):
        print('No')
        exit()
print('Yes')
n = int(input())
H = list(map(int, input().split()))

i = -1
for _ in range(n - 1):
    if H[i - 1] - H[i] > 1:
        ans = "No"
        print(ans)
        exit()
    elif H[i - 1] - H[i] == 1:
        H[i - 1] -= 1
    i -= 1

ans = "Yes"
print(ans)
n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(n-1):
  if ans > A[i+1]:
    print('No')
    exit()
  if A[i+1]-A[i] >= -1:
    ans = max(A[i+1]-1,A[i]-1,ans)
    if A[i+1] >= A[i] and A[i+1] > ans :
      A[i+1] -=1
  else:
    print('No')
    exit()
print('Yes')
n=int(input())
A=list(map(int,input().split()))
deka=-1
for i in range(n):
  if deka>=A[i]+2:
    print("No")
    exit()
  deka=max(deka,A[i])
print("Yes")
n = int(input())
H = list(map(int,input().split()))
ans = "Yes"
 
for i in range(n-1):
    if H[i] < H[i+1]:
        H[i+1] -= 1
    
    if H[i] > H[i+1]:
        ans = "No"
        break
        
print(ans)
# C - Build Stairs

n = int(input())
h = list(int(x) for x in input().split())

ans = 'Yes'
flg = 0 #下がった状態フラグ
for i in range(1, n):
    # 2段以上下がってる場合
    if h[i-1]-h[i]>1:
        ans = 'No'
        break
    if h[i-1]-h[i]==1:
        if flg==0:
            flg = 1
        else:
            ans = 'No'
            break
    if h[i-1]-h[i]<0:
        flg = 0

print(ans)
n=int(input())
h=list(map(int,input().split()))
for i in range(n-1,1,-1):
    if 2<=h[i-1]-h[i]:
        print("No")
        exit()
    elif 1==h[i-1]-h[i]:
        h[i-1]-=1
print("Yes")
N = int(input())
H = list(map(int,input().split()))
can = True

for i in reversed(range(1,N)):
    if H[i - 1] - 1 == H[i]:
        H[i - 1] -= 1
    elif H[i - 1] - 1 > H[i]:
        can = False
        break

print(['No', 'Yes'][can])
N = int(input())
L = list(map(int,input().split()))
for i in range(N-1,0,-1):
    if L[i-1] > L[i]:
        if L[i-1] - 1>L[i]:
            print("No")
            exit()
        L[i-1]-=1
print("Yes")
n = int(input())
h = list(map(int, input().split()))
h.reverse()
pflag = True
for i in range(n - 1):
  if h[i] < h[i + 1]:
    h[i + 1] -= 1
    if h[i] < h[i + 1]:
      pflag = False
      break
if pflag == True:
  print('Yes')
else:
  print('No')
n = int(input())
h = list(map(int, input().split()))

for i in range(n-1):
    if h[i] - h[i+1] < 0:
        h[i+1] -= 1
    if h[i] - h[i+1] > 0:
        print("No")
        exit()
print("Yes")
N = int(input())
H = [int(x) for x in input().split()]
# print(N,H)
result = "Yes"
top = 0
for i in range(len(H)):
    if (H[i] < top-1 ):
        result = "No"
        break
    top = max(top, H[i])

print(result)
n = int(input())
 
h = list(map(int,input().split()))
 
height = h[0]
 
q = 0
 
for i in h:
    if i < height:
        q = 1
        break
    elif i > height:
        height = i-1
    else:
        height = i
        
if q == 1:
    print("No")
else:
    print("Yes")
N = int(input())
H = list(map(int, input().split()))
H[0] -= 1
ans = "Yes"
for i in range(1, N):
    if H[i-1] == H[i]:
        continue
    elif H[i-1] <= H[i]-1:
        H[i] -= 1
    elif H[i-1] > H[i]:
        ans = "No"
        break

print(ans)
n = int(input())
h = [int(x) for x in input().split()]

for i in reversed(range(1, n)):
    if h[i - 1] > h[i]:
        h[i - 1] -= 1

flg = True
for i in range(n - 1):
    if h[i] > h[i + 1]:
        flg = False
        break
        
if flg:
    print('Yes')
else:
    print('No')
n = int(input())

h = list(map(int, input().split()))
h[0] -= 1
for i in range(1, n):
    if h[i - 1] < h[i]:
        h[i] -= 1
    elif h[i - 1] == h[i]:
        pass
    else:
        print("No")
        break
else:
    print("Yes")
n=int(input())
h=list(map(int,input().split()))
t=0
f=0
for i in range(n-1):
    if h[i]<=h[i+1]+1 and t<h[i]:
        h[i]-=1
        t=h[i]
    elif h[i]<=h[i+1] and t==h[i]:
        t=h[i]
    else:
        f=1
        break
if f==0:
    print('Yes')
else:
    print('No')
n = int(input())
h = list(map(int, input().split()))

last=h[0]-1
for now in h[1:]:
    if last > now:
        print("No")
        exit()
    elif last == now: # don't
        last = now
    else: # do
        last = now-1
print("Yes")
n = int(input())
h = list(map(int, input().split()))

flag = True

x = h[0] - 1

for i in range(1, n):
    if h[i] < x:
        flag = False
        break
    elif h[i] == x:
        pass
    else:
        x = h[i] - 1
    
if flag:
    print("Yes")
else:
    print("No")
n = int(input())
list_score = list(map(int, input().split()))
ans = "Yes"
max_value = 0
for i in range(n):
    if list_score[i] > max_value:
        max_value = list_score[i]
    if max_value - list_score[i] > 1:
        ans = "No"
        break

print(ans)
n = int(input())
H = list(map(int,input().split()))
if n==1: print('Yes');exit()
H[0]-=1
for i in range(n-1):
    if H[i]>H[i+1]:
        print('No');exit()
    elif H[i]==H[i+1]:
        continue
    else:
        H[i+1]-=1
print('Yes')
n = int(input())
h = [int(i) for i in input().split()]

j = 0
for i in range(n):
    if h[i] == j:
        pass
    elif h[i] > j:
        j = h[i] - 1
    else:
        if h[i] == j:
            pass
        else:
            print("No")
            break
else:
    print("Yes")
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
ans = ''
for i in range(1, n):
  if h[i - 1] >= h[i]:
    next
  elif h[i] - h[i - 1] == 1:
    h[i] = h[i] - 1
  else:
    ans = 'No'
    break
if ans == '':
  ans = 'Yes'
print(ans)
N = int(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")
import sys
N = int(input())
H = list(map(int, input().split()))

H.reverse()
for n in range(1, N):
    if H[n]-H[n-1]==1:
        H[n] -= 1
    elif H[n]-H[n-1] > 1:
        print("No")
        sys.exit(0)
print("Yes")
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    h = list(map(int, input().split()))
    for i in range(1, n):
        if h[i] - h[i-1] >= 1:
            h[i] -= 1
        if h[i-1] > h[i]:
            print('No')
            return
    print('Yes')

if __name__ == '__main__':
    main()
n = int(input())
h = list(map(int, input().split()))
#b = list(map(int, input().split()))
flag = [0]*n
for i in reversed(range(1, n)):
    if h[i] < h[i-1]:
        h[i-1] -= 1

for i in range(n-1):
    if h[i] > h[i+1]:
        print("No")
        exit()
print("Yes")
N = int(input())
H = list(map(int, input().split()))
H[-1] += 1
for i in range(N - 2, 0, -1):
    if H[i] == H[i + 1]:
        continue
    elif H[i] < H[i + 1]:
        H[i] += 1
    else:
        print("No")
        break
else:
    print("Yes")
N = int(input())
H = list(map(int,input().split()))

for i in range(N-1,0,-1):
    if H[i-1] - H[i] > 1:
        print("No")
        exit()
    if H[i-1] - H[i] == 1:
        H[i-1] -= 1

for i in range(N-1):
    if H[i] > H[i+1]:
        print("No1")
        exit()
        
print("Yes")
import sys, heapq

N = int(input())
H = list(map(int, sys.stdin.readline().rsplit()))

pre = H[0] - 1
for i in range(1, N):
    h = H[i]
    if h - pre > 0:
        pre = h - 1
    elif h - pre == 0:
        pre = h
    else:
        print("No")
        exit()

print("Yes")
N = int(input())
H = list(map(int, input().split()))
f = True
now = H[0]
for i in range(0,N - 1):
  #print(i, now)
  #次が1以上小さい
  if now - H[i + 1] >= 1:
    f = not f
    break
  #次の方が1以上大きい
  elif H[i + 1] - now >= 1:
    now = H[i + 1] - 1

if f:
  print("Yes")
else:
  print("No")
def resolve():
    n = int(input())
    h = list(map(int, input().split()))
    flag = 0
    for i in range(n-1):
        if h[i] == h[i+1]:
            continue
        else:
            h[i+1] -= 1
            if h[i] <= h[i+1]:
                continue
            else:
                print("No")
                exit()
    print("Yes")
resolve()
N = int(input())
H = list(map(int, input().split()))
H.reverse()

ans = True
for i in range(len(H) - 1):
    if H[i] + 1 == H[i + 1]:
        H[i + 1] -= 1
    if H[i] + 1 < H[i + 1]:
        ans = False
        break

if ans:
    print("Yes")
else:
    print("No")
N = int(input())
hhh = list(map(int, input().split()))
for i in range(N - 2, -1, -1):
    if hhh[i] <= hhh[i + 1]:
        pass
    elif hhh[i] - hhh[i + 1] == 1:
        hhh[i] -= 1
    else:
        print('No')
        exit()
print('Yes')
N = int(input())
H = list(map(int,input().split()))

maxH = 0
for i in range(N-1):
  if H[i+1] >= maxH-1:
    maxH = max(maxH,H[i+1])
  else:
    print("No")
    exit()
    
print("Yes")
N = int(input())
H = [i for i in map(int,input().split())]
ok=1
for i in range(N-1,0,-1):
  if H[i-1] > H[i]:
    H[i-1] -= 1

for i in range(1,N-1):
  if not H[i-1] <= H[i] <= H[i+1]:
    ok=0
    break
      
if ok:
  print('Yes')
else:
  print('No')
N = int(input())
H = list(map(int,input().split()))

mx = H[0]
for h in H[1:]:
    if h < mx-1:
        print('No')
        exit()
    mx = max(mx, h)
print('Yes')
n = int(input())
h = [int(i) for i in input().split()]
hmax = h[0]
count = 0
for i in range(1,n):
    if hmax-1 <= h[i]:
        count += 1
        hmax = max(hmax,h[i])
    else:
        break
if n-1 == count:
    print('Yes')
else:
    print('No')
N=int(input())
H=list(map(int,input().split()))
if len(H)==1:
  print("Yes")
  exit()
for i in range(1,N):
  if H[i-1]<=H[i]-1:
    H[i]-=1
  elif H[i-1]>H[i]:
    print("No")
    exit()
else:
  print("Yes")
def main():
    N = int(input())
    H = [int(h) for h in input().split()]

    increase = True
    for i in reversed(range(1, N)):
        if H[i] >= H[i-1]:
            pass
        elif H[i-1] - H[i] == 1:
            H[i-1] -= 1
        else:
            increase = False
            break

    if increase:
        print("Yes")
    else:
        print("No")
        
if __name__ == "__main__":
    main()
N=int(input())
H=list(map(int,input().split()))

for i in range(N):
    if i==0:
        continue
    if  H[i]<H[i-1]:
        print("No")
        exit()
    if H[i-1]<H[i]:
        H[i]-=1

print("Yes")
n = int(input())

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

height = h[0]

q = 0

for i in h:
    if i < height:
        q = 1
        break
    elif i > height:
        height = i-1
    else:
        height = i
        
if q == 1:
    print("No")
else:
    print("Yes")
# C - Build Stairs

N = int(input())
H = [int(h) for h in input().split()]
ans = 'Yes'
for i in range(1, N):
    if H[i - 1] <= H[i] - 1:
        H[i] -=1
    if H[i] < H[i - 1]:
        print('No')
        break
else:
    print('Yes')
n = int(input())
H = list(map(int, input().split()))[::-1]
ok = True
for i in range(n-1):
    if H[i] >= H[i+1]: continue
    if H[i] >= H[i+1]-1:
        H[i+1] -= 1
    else:
        ok = False
        break
print("Yes" if ok else "No")
N = int(input())
H = list(map(int,input().split()))

maxh = 10 ** 10
for i in range(len(H) - 1, -1, -1):
  if H[i] > maxh + 1:
    print("No")
    break
  if H[i] == maxh + 1:
    maxh = H[i] - 1
  else:
    maxh = H[i]
else:
  print("Yes")
N = int(input())
H = list(map(int,input().split()))

for i in range(N-1,0,-1):
    if H[i] + 1 == H[i-1]:
        H[i-1] -= 1
    elif H[i] < H[i-1]:
        print("No")
        exit()
print("Yes")
N = int(input())
H = list(map(int, input().split()))

if N == 1:
    print("Yes")
    exit()

for i in range(N - 1):
    if H[i] < H[i + 1]:
        H[i + 1] -= 1
        pass
    elif H[i] > H[i + 1]:
        print("No")
        exit()

print("Yes")