peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
l = [int(x) for x in input().split()]
#print(l)

for i in range(1,n)[::-1]:
    if l[i-1] - 1 == l[i]:
        l[i] = l[i] + 1
    else:
        continue
    
print(l)

a = 0
for j in range(1, n):
    if l[j-1] <= l[j]:
        continue
    else:
        print('No')
        break
else:
    print('Yes')
N = int(input())
Height = list(map(int, input().split()))
judge = 'Yes'

if (N == 1):
    print(judge)
    exit()

for i in range(N-2):
    # if (Height[i] > Height[i+1]+1 or Height[i]+1 < Height[i+1]):
    if (abs(Height[i]-Height[i+1]) >= 2):
        judge = 'No'

if (Height[-2] > Height[-1]+1):
    judge = 'No'

print(judge)
N = int(input())
H = [int(i) for i in input().split()]
for i in range(N-1):
    if(H[i] > H[i+1]):
        if(H[i] == H[i+1] + 1):
            H[i] -= 1
        else:
            print("No")
            exit()
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()))

zenkai_gen = False
no_flag = False

for i in range(n-1):
  sa = h[i+1] - h[i]
  
  if (zenkai_gen == True) and (sa < 0):
    no_flag = True
  elif sa <= -2:
    no_flag = True
  else:
    pass
    
  if sa <= 0:
    zenkai_gen = True
  else:
    zenkai_gen = False

if no_flag == True:
  print("No")
else:
  print("Yes")
def main(n: int, h: list):
    m = h[0]

    for i in h:
        if i - 1 > m:
            print('No')
            return
        elif i + 1 > m:
            m = i

    print('Yes')


if __name__ == "__main__":
    n = int(input())
    m = list(map(int, input().split()))

    main(n, m)
n = int(input())
h = list(map(int, input().split()))

for i in range(n - 1):
    if h[i] - h[i + 1] > 1:
        print('No')
        break

    elif h[i] - h[i + 1] == 1:
        if x == 1:
            print('No')
            break
        else:
            x = 1


    elif h[i] - h[i + 1] < 1:
        x = 0

else:
    print('Yes')
N = int(input())
a = list(map(int,input().split()))

s = 0
for i in range(1,len(a)):
  if a[i-1]>a[i]:
    s+=1
  if a[i-1]-a[i]>1:
    s+=2
    
if s>=2:
  print("No")
else:
  print("Yes")
n = int(input())
l_list = list(map(int, input().split()))
d = [l_list[i+1]-l_list[i] for i in range(n-1)]

flag = False

for i in d:
    if i < -1:
        print("No")
        break
    if i == -1 and flag == True:
        print("No")
        break
    elif i == -1 and flag == False:
        flag = True
else:
    print("Yes")
n=int(input())

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

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

flag = True
for i in range(N-1, -1, -1):

    if H[i] >= H[i-1]:
        pass
    elif H[i] + 1 == H[i-1]:
        H[i-1] -= 1
    else:
        flag = False

print(H)
if flag:
    print("Yes")
else:
    print("No")
from collections import Counter
a = int(input())
num_list = list(map(int,input().split()))
flag = "ok"
num_o = 0
for i in range(a-1):
  if num_list[i] > num_o:
    num_list[i] = num_list[i]-1
    num_o = num_list[i]
  if num_list[i]-num_list[i+1] > 0:
    flag = "ng"
    break

num_counter = Counter(num_list)
num_most = num_counter.most_common()
#if a == num_most[0][1] and a != 0:
#  flag = "No"
if flag == "ok":
  print("Yes")
N = int(input())
H = [i for i in map(int,input().split())]
ok=1
for i in range(N-1):
  if H[i+1] < H[i]:
    H[i] -= 1
    if H[i+1] < H[i] or H[i] < H[i-1]:
      ok=0
      break
      
if ok:
  print('Yes')
else:
  print('No')
n = int(input())
h = list(map(int, input().split()))
m = h[0]
ans = 1
r = 0
for i in range(n):
    if m>h[i]:
        if m-h[i]==1:
            if r==0:
                r+=2
            else:
                ans=0
        else:
            ans=0
    if r>0:
        r-=1
    m = h[i]
if ans==1:
    print("Yes")
else:
    print("No")
N=int(input())
H=list(map(int,input().split()))
H_copy=H.copy()
for i in range(N-1):
    if H[i]==H[i+1]+1:
        if H_copy[i-1]==H_copy[i]+1:
            print('No')
            exit()
        H[i]-=1
    elif H[i]-H[i+1]>=2:
        print('No')
        exit()
print(H)
print('Yes')
n = int(input())
li = list(map(int,input().split()))
f = 0
for i in range(len(li)-1):
    if li[i] > li[i+1]:
        li[i] = li[i] - 1
    if li[i] > li[i+1]:
        f = 1
        break

if f:
    print('No')
else:
    print('Yes')
n=int(input())
h=list(map(int,input().split()))
for i in range(n-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()))
ans="Yes"
cngh=0
bkh=0
for i in range(n):
  if bkh>h[i]:
    if cngh!=h[i] and bkh==h[i]-1:
      cngh=h[i]-1
    elif (cngh!=h[i] and bkh!=h[i]-1) or (cngh==h[i] and cngh!=h[i]):
      ans="No"
      break
  bkh=h[i]
print(ans)
N = int(input())
H = list(map(int, input().split()))

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

flag = True
for i in range(N-1, -1, -1):

    if H[i] >= H[i-1]:
        pass
    elif H[i] + 1 == H[i-1]:
        H[i-1] -= 1
    else:
        flag = False

# print(H)
if flag:
    print("Yes")
else:
    print("No")
N=int(input())
S=list(map(int,input().split()))
Z=[0]*N

for i in range(1,N):
    Z[i]=S[i]-S[i-1]


flug=False
for i in range(N):
        
    if Z[i]<=-1 and flug==False:
        flug=True
    elif Z[i]<=-1 and flug==True:
        print("No")
        exit()
print("Yes")
n = int(input())
h = list(map(int, input().split()))
h.append(1001001001)
can = True
for i in range(n):
    if h[i] > h[i + 1]:
        h[i] -= 1
for i in range(n):
    if h[i] > h[i + 1]:
        can = False
        break
if can:
    print('Yes')
else:
    print('No')
N = int(input())
H = list(map(int, input().split()))

lis = list()
for i in range(len(H)-1):
    if H[i] - H[i+1] < -1:
        H[i+1] = H[i+1] - 1
        lis.append(1)
    else:
        lis.append(0)

if all(lis):
    print("Yes")
else:
    print("No")
N = int(input())
H = list(map(int, input().split()))

flg = 1
for i in range(N-1):
    if H[i] - 1 > H[i+1]:
        flg = 0
        break
    elif H[i] - 1 == H[i+1]:
        if i == 0:
            H[i] -= 1
            continue
        if H[i-1] > H[i] - 1:
            flg = 0
            break
        H[i] -= 1
if flg == 1:
    print('Yes')
elif flg == 0:
    print('No')
N = int(input())
H = list(map(int, input().split()))
 
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] -= 1
  else:
    ans = 'No'
    break

for i in range(N):
  if H[i-1] > H[i]: 
    ans = 'No'
    break
    
print(ans)
# Problem C - Build Stairs

# input
N = int(input())
h_list = list(map(int, input().split()))

# initialization
is_ok = True

if N>1:
    tmp_max = h_list[-1]
    for i in range(N-2, -1, -1):
        if h_list[i]>tmp_max:
            h_list[i] -= 1
        if not h_list[i]<=tmp_max:
            is_ok = False
            break

# output
if is_ok:
    print("Yes")
else:
    print("No")
N=int(input())
H=list(map(int,input().split()))
if N>1:
    for i in range(N-1):
        if H[i]<=H[i+1]-1:
            H[i+1]-=1
        if H[i]>H[i+1]:
            print('NO')
            exit()
    print('YES')
else:
    print('YES')
import sys
N = int(input())
h = list(map(int, input().split()))
count = 0

for i in range(1, N-1):
    diff = h[i+1] - h[i]
    if diff == -1:
        count += 1
        if h[i] == h[i-1]:
            print('No')
            sys.exit()
    elif diff < -1:
        print('No')
        sys.exit()        
    if count > 1:
        print('No')
        sys.exit()
print('Yes')
n = int(input())
l = list(map(int, input().split()))
if n>2:
    for i in reversed(range(1,n)):
        if l[i] <l[i-1]:
            print("No")
            exit()
print("Yes")
import bisect,collections,copy,heapq,itertools,math,operator,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
N = I()
H = LI()
for i in range(N-1):
    if i==0:
        continue
    if H[i-1]<=H[i]<=H[i+1]:
        continue
    if H[i-1]<=H[i]-1<=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):
    if H[i+1] - (H[i]-1) > 1:
        print("No")
        break
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]>1:
        ans="No"
        break
print(ans)
import numpy as np
import sys
n = int(input())
h = np.array(list(map(int, input().split())))
ans = "No"
for i in range(n-1):
    dif = h[i] - h[i+1]
    if dif > 1:
        print(ans)
        sys.exit()
    elif dif == 1:
        h[i] -= 1

max_h = 0
for i in range(1, n):
    max_h = max(max_h, h[i-1])
    dif = h[i] - max_h
    if dif >= 0:
        print(ans)
        sys.exit()
ans = "Yes"
print(ans)
n = int(input())

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

diff_list = []

for i in range(n-1):
    diff_list.append(l[i+1]-l[i])
    
for i in range(1,n-2):
    if diff_list[i] < 0:
        diff_list[i] += 1
        diff_list[i-1] -= 1

if len(diff_list) == 0:
    print("Yes")

for i in range(n-2):
    if diff_list[i] < 0:
        print("No")
        break
    print("Yes")
import numpy as np
n = int(input())
h = np.array([int(i) for i in input().split()])
diff = np.diff(h)
flag = True
for i in diff:
    if i < -1:
        flag = False
        break
    elif i > 0:
        flag = True
    elif i == -1:
        if not flag:
            break
        flag = False
print('Yes') if flag else print('No')
a = int(input())
b = list(map(int,input().split()))
c = b[0]
d = 0
for i in range(a-1):
  if c - 1 <= b[i+1]:
    c =  b[i+1]
    d += 1
if d == a-1:
  print("Yes")
else:
  print("No")
n = int(input())
h = list(map(int,input().split()))

ans = 1
for i in range (n-1):
    if (h[i]-h[n-1] >= 2):
        ans = 0
        break

if (ans == 1):
    print("Yes")

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

h0 = H[0]
for i in range(1, n):
    h = H[i]
    if h <= h0:
        H[i-1] = h0-1
    h0 = h

flg = True
h0 = H[0]
for h in H[1:]:
    flg &= h0 <= h
    h0 = h
if flg:
    print('Yes')
else:
    print('No')
n = int(input())
H = [0] + list(map(int, input().split()))
pre_d = 1
for i in range(n-1):
  d = H[i+1] - H[i]
  if d >= 1:
    continue
  if d == 0:
    continue
  if d == -1:
    if pre_d >= 1:
      H[i] -= 1
    else:
      print("No")
      break
  if d <= -2:
    print("No")
    break
else:
  print("Yes")
def do():
    k=0
    a=int(input())
    l=list(map(int,input().split()))
    for i in range (a-1):
        if l[i]-l[i+1]>=2:
            return "No"
        if l[i]-l[i+1]==1:
            k+=1
        else:
            k=0
    if k>=2:
        return "No"
    else:
        return "Yes"

print(do())
N = int(input())
A = list(map(int, input().split()))
if N == 1:
    print("Yes")
else:
    k = 0
    for i in range(N -1):
        if (A[i] - A[i+1]) >= 2:
            k  += 1
    if k < 1 and (A[N-1] - A[i]) >1:
        print("Yes")
    else:
        print("No")
N = int(input())
H = list(map(int, input().split()))

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

#print(H)

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[0]-=1
for i in range(1,N-1):
	if H[i]>H[i+1]:
		H[i]-=1
		if H[i]>H[i+1]:
			print('No')
			exit()
		elif H[i-1]>H[i]:
			print('No')
			exit()	
print('Yes')
n = int(input())
H1 = list(map(int,input().split()))
H2 = list(map(lambda x: x - 1, H1))


ans = "Yes"
prev = H2[0]
for i in range(1,n-1):
    if H2[i] == prev+1:
        prev += 1
    elif H2[i] > prev+1:
        ans = "No"
        break

print(ans)
import sys
N = int(input())
H = list(map(int, input().split()))

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

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

for i in range(n-1):
    if h[i+1] < h[i]:
        print('No')
        quit()

print('Yes')
N = int(input())
H = list(map(int,input().split()))
ans = "Yes"
num_max = 0
for i in range(1,N):
	if H[i] < num_max:
		ans = "No"
		break
	if H[i] >= H[i-1]:
		ans = "Yes"
	elif H[i] >= H[i-1] -1:
		ans = "Yes"
		H[i-1] -= 1
	else:
		ans = "No"
		break
	num_max = max(num_max,H[i - 1])
print(ans)
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]-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  
  else:
    if h[i]>=Fx:
      FL=False
print(ans)
N = int(input())
H = [int(x) for x in input().split()][::-1]
b = int(10e9) + 1
for h in H:
    if h >= b + 2:
        print('No')
        exit()
    b = min(h, b - 1)
print('Yes')
import sys
n=int(input())
h=list(map(int,input().split()))
if n==1:
    print("Yes")
    sys.exit()
h[0]-=1
for i in range(1,n-1):
    if h[i-1]<=h[i]<=h[i+1]:
        pass
    else:
        h[i]-=1
        if h[i-1]<=h[i]<=h[i+1]:
            pass
        else:
            print("No")
            sys.exit()
print("Yes")
n=int(input())
H=list(map(int,input().split()))
ans='Yes'
for i in range(1,n-1):
    if H[i]<H[i-1] or H[i]-1>H[i+1]:
        ans='No'
        break
    
print(ans)
n = int(input())
h = list(map(int, input().split()))

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

for i in range(n - 1):
    if h[i] > h[i + 1]:
        print("No")
        exit()
print("Yes")
n=int(input())

h=[int(x) for x in input().split()]
m=h[0]
for i in range(n):
  #print(c,-i)
  if h[i]>=m-1:
    print("No")
    exit()
  m=max(m,h[i])
print("Yes")
N = int(input())
H = list(map(int,input().split()))
check = 0
mx = H[0]
m = max(H)
for i in range(0,N-1):
  mx = max(mx,H[i])
  if(H[i]-H[i+1] > 2):
    check = 1

if(m - H[N-1] >= 2):
  check = 1
    
if(check == 1):
	print("No")
else:
	print("Yes")
N=int(input())
H=list(map(int, input().split()))

for i in range(N-1):
	#print(i,H[i],H[i+1])
	if H[i]+1==H[i+1]:
		H[i+1]-=1
	elif H[i]<=H[i+1]:
		continue
	else:
		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[i]>1+a[i+1]:
        print("No")
        exit()
    elif a[i]==a[i+1]+1:
        a[i]-=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(map(int,input().split()))
safe = True
for i in reversed(range(1,N)):
  if H[i] <= H[i-1]:
    H[i] +=1
for i in range(N-1):
  if H[i] > H[i+1]:
    safe = False
    break
print('Yes' if safe else 'No')
n = int(input())
stair = list(map(int, input().split()))
top = max(stair)
if stair.index(top) == n-1:
    print("Yes")
    exit()
low = min(stair[stair.index(top):])
print(low)
if top - low > 1:
    print("No")
else:
    print("Yes")
N = int(input())

h = [int(x) for x in input().split()]
x = h[0]
i = 1
k = 0
for _ in [0]*(N-1):
  y = h[i]
  i += 1
  if (y - x == -1) and k == 1 :
    print('No')
    exit()
  elif y - x == -1:
    x = y
    k = 1
  elif y - x >= 0:
    x = y
    k = 0
  else:
    print('No')
    exit()

print('Yes')
n=int(input())
h=list(map(int,input().split()))
count=0
for i in range(n-1):
    if h[i+1]-h[i]>=2:
        print("No")
        count+=1
        break
    elif h[i]-h[i+1]==1:
        h[i]-=1
    elif h[i+1]-h[i]==0:
        continue
if count==0:
    print("Yes")
n = int(input())
h = list(map(int, input().split()))
# sv = h[n-1]
ok = True
for i in range(1, n):
    # if h[i] - sv + 1 >= 2:
        # ok = False
    if h[i] - h[i-1] < 0:
        ok = False
if ok:
    print('Yes')
else:
    print('No')
import sys
N=int(input())

H=[int(x) for x in input().rstrip().split()]
flag=0
mi=-1
for i in range(N-1):
  mi=max(H[i],mi)
  if H[i]<=H[i+1] and mi<=H[i]:

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

    if H[i+1]<H[i] or H[i]<mi:
      flag=1
      print("No")
      sys.exit()

if flag==0:
  print("Yes")
n = int(input())
apple = list(map(int, input().split()))
cat = apple[0]
count = 0
for i in range(n - 1):
    if apple[i] <= apple[i + 1]:
        cat = apple[i + 1]
        pass
    else:
        if apple[i + 1] + 1 == cat:
            pass
        else:
            count = 1
            break
print("Yes" if count == 0 else "No")
N = int(input())
H = list(map(int, input().split()))
# A = []
# for a in range(N+1):
#     A.append(int(input()))

H[0] -= 1

for i in range(1, N):

    if H[i-1] > H[i]:
        print('NO')
        exit()

    H[i] = max(H[i-1], H[i] - 1)

print('YES')
N = int(input())
H = list(map(int, input().split()))
# H[N-2],H[N-3],...,H[0]について
for i in range(N - 2, -1, -1):
    if H[i] > H[-1] + 1:
        print("No")
        exit()
print("Yes")
n = int(input())
h = list(map(int,input().split()))

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

ans = "Yes"
for i in range(N - 1):
  if H[i] <= H[i+1]:
    continue
  elif H[i] - 1 <= H[i + 1] and H[i] - 1 >= H[i - 1]:
    H[i] -= 1
  else:
    ans = "No"
    break
print(ans)
input()
H = [int(i) for i in input().rstrip().split(' ')]
N = len(H)

for i in range(0,N):
    a = H[i]
    b = H[i - 1] if i > 0 else 0
    n = H[i + 1] if i < N -1 else 10**9
    #print(i,"#",b,a,n)
    if n == a - 1:
        if b >= a:
            print("No")
            break
        else:
            H[i] -= 1
    elif n < a - 1:
            print("No")
            break
else:
    print("Yes")
#print(H)
def resolve():
    N = int(input())
    H = list(map(int, input().split()))

    for i in range(N-1):
        if H[i] <= H[i+1]:
            pass
        elif H[i] - 1 <= H[i+1]:
            H[i] = H[i]-1
        else:
            pass
        
    if H != sorted(H):
        print('No')
    else:
        print('Yes')

    return
resolve()
n = int(input())
h = list(map(int,input().split()))
flag = True
for i in range(n-1):
    if h[i] - h[i+1] == 1:
        h[i] -= 1
        if h[i-1] > h[i]:
            print('No')
            flag = False
            break
    elif h[i] - h[i+1] >= 2:
        print('No')
        flag = False
        break
if flag:
    print('Yes')
N=int(input())
*H,=map(int,input().split())

i=0
sm=[0]*(N-1)
while i+1<=N-1:
    sm[i]=min(H[i+1]-H[i],0)
    i+=1

print('YNeos'[sum(sm)<=-2::2])
n = int(input())
h = list(map(int, input().split()))

f = True
for i in range(n-2):
    if h[i] > h[i+1] > h[i+2]:
        f = False
        break
    if h[i] > h[i+1]:
        h[i]-=1
    if h[i] > h[i+1]:
        f = False
        break
if f: print('Yes')
else: print('No')
n = int(input())
hs = [int(elem) for elem in input().split()]

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

is_clear = True
for n in range(1, N):
    if n != N-1:
        if H[n] - H[n+1] == 1:
            H[n] -= 1
        elif H[n] - H[n+1] > 1:
            is_clear = False
            break
    if H[n] < H[n-1]:
        is_clear = False
        break

if is_clear:
    print("Yes")
else:
    print("No")
import numpy as np
N = int(input())
H = np.array(list(map(int,input().split())))
D = np.diff(H,n=1)
if len(D[D == -1]) <= 1 and len(D[D < -1]) == 0:
    print('Yes')
else:
    print('No')
import sys

n=int(input())
h=list(map(int,input().split()))
be=h[0]

for i in range(n):
  if h[i]-be==1 or h[i]-be==2:
    be=h[i]-1
    continue
      
  if h[i]<be:
    print("No")
    sys.exit()
    
  be=h[i]
  
print("Yes")
n = int(input())
h = list(map(int,input().split()))

for i in reversed(range(1,n)):
    print(i)
    if h[i-1] - h[i] == 1:
        h[i-1] -= 1
    elif h[i-1] - h[i] >=2:
        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]-1 >= h[i+1]:
               h[i] -=1
if h == sorted(h):
        print('Yes')

else:
        print('No')
a=int(input())
b=list(map(int,input().split()))
for i in range(a-1):
    if b[i]-1>b[i+1]:
        print('No')
        exit()
print('Yes')
n = int(input())
h = list( map(int,input().split()) )
 
ck = True
for i in range(n-1):
  if h[i] > h[i+1]:
    h[i] -= 1
    if h[i] > h[i+1]:
        ck = False
        break

print('Yes' if ck else 'No')
N = int(input())
H = list(map(int,input().split()))
flg = 0
ans = "Yes"

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

for j in range(N-1):
  if H[j] > H[j+1]:
    ans = "No"

print(ans)
N = int(input())
Hlist = list(map(int,input().split()))
sign = 1
Answer = 'Yes'
for i in range(len(Hlist)-1):
    H1 = Hlist[i]
    H2 = Hlist[i+1]
    if H1 > H2:
        if H1 - H2 == 1 and sign == 1:
            Hlist[i] -= 1
            sign =0
        else:
            Answer = 'No'
            break
    else:
        sign = 1
print(Answer)
n = int(input())
h = list(map(int, input().split()))


for i in range(n-1):
    if h[i+1] < h[i]:
        h[i] -= 1

ans = sorted(h)
if ans == h:
    print('Yes')
else:
    print('No')
N = int(input())
H = list(map(int, input().split()))
ans = True
lis = {}
for i in H:
  if i in lis:
    lis[i] += 1
  else:
    lis[i] = 1
mine = min(H)
times = lis[mine]
for i in range(N):
  if mine < H[i]-1:
    ans = False
    break
  else:
    if H[i] == mine:
      times -= 1
    if times == 0 and i != N-1:
      del lis[mine]
      mine = next(iter(lis))
      times = lis[next(iter(lis))]
if ans:
  print("Yes")
else:
  print("No")
n = int(input())
h = list(map(int, input().split()))
if len(h) == 1:
  print("Yes")
elif h[0] >= h[1] + 2 or h[-2] >= h[-1] + 2:
  print("No")
else:
  for i in range(n-2):
    if h[i] >= h[i+2] + 2:
      print("No")
      break
  else:
    print("Yes")
import sys
n=int(input())
h=list(map(int,input().split()))
h[0]-=1
for i in range(n-1):
    if h[i]<=h[i+1]:
        pass
    else:
        h[i]-=1
        if h[i]<=h[i+1]:
            pass
        else:
            print("No")
            sys.exit()
print("Yes")
N = int(input())
H = list(map(int, input().split()))
flag = True
reach = False

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

for i in range(n-1):
    if n == 1:
        break
    elif i == n-2:
        if -1 <= h[i+1] - h[i]:
            continue
        else:
            ans = 'No'
    else:
        if -1 <= h[i+1] - h[i] <= 1:
            continue
        else:
            ans = 'No'
            break

print(ans)
n = int(input())
H = list(map(int, input().split()))

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

ans = "Yes"
for i in range(1, n):
    if not(0 <= H[i] - H[i - 1] <=1):
        ans = "No"

print(ans)