peterverebics/CodeNet_Python_118 huggingface dataset:
n=int(input())
hi=[]
for i in map(int,input().split()):
    hi.append(i)
YesNo="Yes"    
for i in range(n-1,1,-1):
    if hi[i]+2<=hi[i-1]:
        YesNo="No"    
#        print("No")
        break
    elif hi[i]+1==hi[i-1]:
        hi[i-1]=hi[i-1]-1
print(YesNo)
N,*H=map(int,open(0).read().split())
H[0]-=1
def main():
    for i in range(1,N):
        if H[i-1]<H[i]:
            H[i]-=1
        elif H[i-1]==H[i]:
            continue
        else:
            return 'No'
    return 'Yes'
print(main())
N = int(input())
H = list(map(int, input().split()))
bl = True

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

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

print('Yes' if bl else 'No')
import sys
n = int(input())
h = list(map(int,input().split()))
h = h[::-1]

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

ans = 'Yes'
for j in range(n-1):
    if h[j] < h[j+1]:
        print('No')
        sys.exit()

print(ans)
import sys
stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

N=int(input())
H=nl()
flag=True

H[0]-=1
for i in range(1,N-1):
    if(H[i-1]<H[i]):
        H[i]-=1
    if(H[i]>H[i+1]):
        flag=False

print('Yes' if flag==True else 'No')
N = int(input())
H = [int(s) for s in input().split()]
for i in range(N - 1):
    if H[i + 1] - H[i] >= 0:
        H[i + 1] -= H[i + 1] != H[i]
    else:
        print('No')
        exit(0)

print('Yes')
import sys
n=int(input())
h=list(map(int, input().split()))

mx=0
for i in range(n):
    if h[i]<=mx-2:
        print("No")
        sys.exit()
    if h[i]>mx:
        mx=h[i]

        
print("Yes")
# ABC136C

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

if n == 1:
    print("Yes")
    sys.exit()

for i in range(n-1,0,-1):
    if h[i] != h[i-1]:
        if h[i] - h[i-1] < -1:
            print("No")
            sys.exit()
        elif h[i] - h[i-1] < 0:
            h[i-1] -= 1

print("Yes")
n=int(input())
l=list(map(int,input().split()))
if(n==1):
    print("Yes")
else:
    f=0
    for i in range(n-1,-1,-1):
        if(l[i]+1==l[i-1]):
            l[i-1]-=1
    for i in range(n-1):
        if(l[i+1]<l[i]):
            f=1
            break

    if(f==0):
        print("Yes")
    else:
        print("No")
n = int(input())
h = list(map(int, input().split()))
Flag = "Yes"
maxh = 0

if n >= 2 :
  for i in range(1,n):
    if h[i-1] > h[i]:
      h[i-1] = h[i-1] - 1
      if h[i-1] > maxh:
        maxh = h[i-1] 
      if h[i-1] > h[i] or maxh > h[i] :
        Flag = "No"
      
print(Flag)
def resolve():
    N = int(input())
    H = list(map(int, input().split()))

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

        if H[i] > H[i+1]:
            print('No')
            return

    print('Yes')

    return
resolve()
n,*h=map(int,open(0).read().split())
for i in range(n-1)[::-1]:
  if h[i+1]<h[i]:
    h[i]-=1
    if h[i+1]<h[i]:
      print('No')
      exit()
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] -= 1
    elif h[i] > h[i+1]:
        print("No")
        exit()
print("Yes")
def main():
    n = int(input())
    h_list = list(map(int, input().split()))
    for i in range(n - 1)[::-1]:
        if h_list[i] == h_list[i + 1] + 1:
            h_list[i] = h_list[i] - 1
        elif h_list[i] > h_list[i + 1] + 1:
            print("No")
            return
    print("Yes")

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

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

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

print("Yes")
n = int(input())
h = list(map(int, input().split()))
h[0] -= 1
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()
print("Yes")
N=int(input())
H=list(map(int,input().split()))
M=1
ans="Yes"

for i in range(N):
    if M<H[i]:
        M=H[i]
    elif M==H[i]:
        pass
    elif M-1==H[i]:
        pass
    else:
        ans="No"
        break

print(ans)
N = int(input())
H = list(reversed(list(map(int, input().split(' ')))))

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

    if H[i - 1] < H[i]:
        print('No')
        break
else:
    print('Yes')
n = int(input())
h = [int(i) for i in input().split()]
ans =  True
maxv = h[0]
for i in range(n-1):
        if h[i] > h[i+1]:
            if maxv-h[i+1] >= 2:
                ans = False
        elif maxv < h[i+1]:
            maxv = h[i+1]
if ans == True:
    print('Yes')
else:
    print('No')
N=int(input())
H=list(map(int, input().split()))
L=[float('inf')]*N
L[N-1]=H[N-1]
for i in range(1,N):
  a=H[N-i-1]
  if a-1>L[N-i]:
    print('No')
    exit()
  L[N-i-1]=min(a,L[N-i])
else:
  print('Yes')
n = int(input())
h = map(int, input().split())

height = 0

for k in h:
    
    if k - height >= -1:
        height = max(height, k)
    else:
        print("No")
        exit()

print("Yes")
def check():
    N = int(input())
    H = [int(i) for i in input().split()]
    
    max_h = 0
    
    for h in H:
        if max_h-1 > h:
            return 'No'
        if max_h <= h-1:
            max_h = h
    return 'Yes'
  
print(check())
N = int(input())
H = list(map(int, input().split()))
H[0]-=1
for i in range(N-1):
    if H[i+1] - H[i] > 0:
        H[i+1]-=1
    if H[i] - H[i+1] > 0:
        print('No')
        exit()
print('Yes')
def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    flag = True

    for i in range(n-1):
        if num_list[i] != 1 and num_list[i-1] < num_list[i]:
            num_list[i] -= 1
        if num_list[i]  > num_list[i+1]:
            flag = False
            break
            
    print('Yes' if flag else 'No')

if __name__ == '__main__':
    main()
N = int(input())
H = tuple(reversed(tuple(map(int, input().split()))))
assert len(H) == N

result = True
prev = None
for i,h in enumerate(H):
  if prev is not None:
    if h > prev + 1:
      result = False
      break
    if h < prev + 1:
      prev = h
  else:
    prev = h
print('Yes' if result else 'No')
N = int(input())
H = list(map(int,input().split()))

for i in range(1, N)[::-1]:
  d = H[i] - H[i-1]
  if d >= 0:
    continue
  elif d == -1:
    H[i-1] -= 1
  else:
    print("No")
    exit()
print("Yes")
# -*- coding: utf-8 -*-
n = int(input())
h = list(reversed(list(map(int, input().split()))))

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

print('Yes')
input()
a=list(map(int,input().split()))
pivot=0
flag=0
for i in a:
  if pivot<i:pivot=i
  if pivot-i>1:flag=1;break
print('YNeos'[flag::2])
N = int(input())
H = list(map(int,input().split()))
i = 0
H[0] -= 1

while True:
    if N == 1:
        answer = 'Yes'
        break
    if H[i]<H[i+1]:
        H[i+1] -= 1
    if H[i]>H[i+1]:
        answer = 'No'
        break
    i += 1
    if i == N-1:
        answer = 'Yes'
        break
print(answer)
n = int(input())
a = list(map(int, input().split()))

flag = True
for i in range(n-1):
    if a[n-i-2] > a[n-i-1]:
        a[n-i-2]-= 1

    if a[n-i-2] > a[n-i-1]:
        flag = False
        break

print("Yes") if flag else print("No")
n = int(input())
hs = map(int, input().split())
hsrev = list(hs)[::-1]

for i in range(len(hsrev)-1):
    if hsrev[i] < hsrev[i+1]:
        hsrev[i+1] -= 1
        if hsrev[i] < hsrev[i+1]:
            print("No")
            exit()

print("Yes")
n, *h = map(int, open(0).read().split())

for i in range(n-1):
    s = h[-i-2] - h[-i-1]
    if s == 1:
        h[-i-2] -= 1
    elif s > 1:
        print("No")
        exit()
print("Yes")
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 13, 2020 15:38:31 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from collections import defaultdict
from collections import deque
from collections import OrderedDict
import itertools
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  H = list(map(int, input().split()))

  for i in range(1, N):
    if H[i] >= H[i-1]:
      continue
    elif H[i] + 1 == H[i-1]:
      H[i] += 1
    else:
      print('No')
      return
  print('Yes')


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

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

print("Yes")
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    if i!=0:
        if a[i]>a[i-1]:
            a[i]-=1
    else:
        a[i]-=1
for i in range(n):
    if i!=n-1:
        if a[i]>a[i+1]:
            print('No')
            exit()
print('Yes')
#https://atcoder.jp/contests/abc136/tasks/abc136_c

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

flag = 'Yes'
for i in reversed(range(n - 1)):
    if h[i+1] - h[i] < 0 and h[i+1] - h[i] >= -1:
        h[i] -= 1
    elif h[i+1] - h[i] <= -2:
        flag = 'No'
        break
print(flag)
n=int(input())
l=list(map(int,input().split()))
i=n-1
flag=False
while 1<=i and i<=n-1:
    if l[i]+2<=l[i-1]:
        print('No')
        flag=True
        break
    elif l[i]+1==l[i-1]:
        l[i-1]-=1
        i-=1
    else:
        i-=1
if flag==False:
    print('Yes')
n = int(input())
h = list(map(int, input().split()))
maxx = 0
ans = 1
for i in range(n):
    if h[i] - maxx >= -1:
        maxx = max(h[i], maxx)
    else:
        ans = 0
print(["No", "Yes"][ans])
N = int(input())
H = list(map(int,input().split()))

if N == 1:
    print('Yes')
else:
    for i in range(N-1):
        if H[N-1-i] + 2 <= H[N-1-i-1]:
            print('No')
            break
        elif H[N-1-i] + 1 == H[N-1-i-1]:
            H[N-1-i-1] -= 1
        elif i == N-2 and H[0] <= H[1] + 1:
            print('Yes')
n=int(input())

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

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

    if flag:
        print("Yes")
    else:
        print("No")


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

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

print("Yes")
n = int(input())
stair = input().split(' ')

for i in range(0, n - 1):
  if (int(stair[i]) < int(stair[i+1])):
    stair[i+1] = int(stair[i+1]) - 1

  if (int(stair[i]) > int(stair[i+1])):
    print("No")
    exit()


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

for i in reversed(range(N-1)):
    if Hs[i] - Hs[i+1] >= 2:
        print('No')
        break
    elif Hs[i] - Hs[i+1] == 1:
        Hs[i] -= 1
else:
    print('Yes')
n= int(input())
a = [int(i) for i in input().split()]

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

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

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

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

print("Yes")
n = int(input())
S = list(map(int, input().split()))[::-1]

flag = True
for i in range(1, n):
  if S[i] > S[i-1]:
    S[i] -= 1
    
  if S[i] > S[i-1]:
    flag = False
    break

print("Yes" if flag else "No")
N = int(input())
H = list(map(int, input().split()))
now = H[0]

for h in H:
    if h > now:
        now = h - 1
    elif h == now:
        continue
    else:
        print('No')
        exit()
print('Yes')
n = int(input())
h = list(map(int, input().split()))
h.reverse()
for i in range(n-1):
  if h[i]<h[i+1]:
    h[i+1]-=1
h.reverse()
for j in range(n-1):
  if h[j]>h[j+1]:
    print('No')
    exit()
else:
  print('Yes')
N=int(input())
H=list(map(int,input().split()))
HR=list(reversed(H))

for i in range(1,N):
  if HR[i]>HR[i-1]:
    HR[i]-=1
    if HR[i]>HR[i-1]:
      print('No')
      exit()
print('Yes')
n=int(input())
H=list(map(int,input().split()))

isOK=True
for i in range(n-1,0,-1):
    diff=H[i-1]-H[i]
    if diff<1:
        pass
    elif diff==1:
        H[i-1]-=1
    else:
        isOK=False
        break

if isOK:
    print("Yes")
else:
    print("No")
#!/usr/bin/env python
# coding: utf-8

# In[18]:


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


# In[19]:


flag = True
mylist = list(reversed(H))
for i in range(1,N):
    if mylist[i] > mylist [i-1] + 1:
        flag = False
        break
    elif mylist[i] == mylist[i-1] + 1:
        mylist[i] = mylist[i]-1
if flag:
    print("Yes")
else:
    print("No")


# In[ ]:
import numpy as np

N = int(input())
H = np.array(list(map(int, input().split())))

ans_1 = min(H[np.where(H==H.max())[0].min():]) > max(H)-2
ans_2 = all((H[1:] - H[:-1]) > -2)

print("Yes") if ans_1 & ans_2 else print("No")
def resolve():
    n = int(input())
    h = list(map(int, input().split()))
    OK = True
    for i in range(1, len(h)):
        if h[i] == h[i-1]:
            continue
        elif h[i] > h[i-1]:
            h[i] -= 1
        else:
            OK = False
            break
    if OK:
        print("Yes")
    else:
        print("No")
resolve()
N = int(input())
H = list(map(int, input().split()))

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

is_judge = True
for i in reversed(range(n-1)):
	if h[i]>h[i+1]:
		if h[i]-1 > h[i+1]:
			is_judge = False
		else:
			h[i] = h[i]-1



if is_judge:
	print('Yes')
else:
	print('No')
N=int(input())
H=[int(s) for s in input().split(" ")]

#左右差のリストを作成。(+1,-1),(-1,+1)の区間は直せる

List=[]
for i in range(N-1):
    List.append(H[i+1]-H[i])

count=0
for i in range(len(List)):
    count+=List[i]
        
    if count>=1:
        count=0
    if count<=-2:
        count=-2
        break

print("Yes" if count>=-1 else "No")
n = int(input())
h = list(map(int, input().split()))

for i in range(n-1,1,-1):
    dif = h[i] - h[i-1]
    if(dif == -1):
        h[i-1] -= 1
    elif(dif < -1):
        print('No')
        exit()

print('Yes')
N = int(input())
Hs = [int(i) for i in input().split()]

is_Yes = True
for i in range(1, N):
    if Hs[i-1] == Hs[i]:
        continue
    elif Hs[i] > Hs[i-1]:
        Hs[i] -= 1
    else:
        is_Yes = False
        break

if is_Yes:
    print('Yes')
else:
    print('No')
N = int(input())
H = list(map(int, input().split()))
m = H[0]
for h in H[1:]:
    if m - h > 1:
        print('No')
        break
    m = max(m, h)
else:
    print('Yes')
from sys import *

n = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
last = arr[n - 1]
for i in range(n - 1, -1, -1):
	if arr[i] > last:
		d = arr[i] - last
		if d > 1:
			print("No")
			exit(0)
	last = min(last, arr[i])
print("Yes")
N = int(input())
H = list(map(int, input().split()))
res = 'Yes'
for i in range(N-1):
    if H[i] < H[i+1]:
        H[i+1] -= 1
    elif H[i+1] - H[i] == 0:
        continue
    else:
        res = 'No'
        break
print(res)
def ok(hs):
    m = 0
    for h in hs:
        if h < m - 1:
            return False
        m = max(m, h)
    return True
 
n = int(input())
print('Yes' if ok(map(int, input().split())) else 'No')
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 25 20:51:57 2020

@author: Kanaru Sato
"""

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

flag = 0
mh = 10**10

for i in range(n-1):
    if h[n-1-i]-mh <= 1:
        mh = min(mh, h[n-1-i])
    else:
        flag = 1
        break

if flag == 1:
    print("No")
else:
    print("Yes")
n = int(input())
h = list(map(int, input().split()))

check = 0

if n == 1:
	print('Yes')

else:
	for i in range(n-2):
		if h[i] < h[i+1]:
			h[i+1] -= 1
	for i in range(n-1):
		if h[i] > h[i+1]:
			print('No')
			break
		if h[i] <= h[i+1]:
			check += 1
	if check == n-1:
		print('Yes')
n = int(input())
squeres = list(map(int, input().split()))
flag = True
before_down = 0
for i in range(n - 1):
    if squeres[i] > squeres[i + 1] and squeres[i] - 1 <= squeres[i + 1] and before_down == 0:
        before_down = 1

    elif not squeres[i] <= squeres[i + 1]:
        flag = False
    
    else:
        if squeres[i] < squeres[i + 1]:
            before_down = 0
if flag:
    print("Yes")
else:
    print("No")
N = int(input())
F = [int(x) for x in input().split()]

flag = True
for i in range(N-1):
    if F[i] < F[i+1]:
        F[i+1] -= 1
    elif F[i] > F[i+1]:
        flag = False
        break
    
if flag == True:
    print("Yes")
else:print("No")
n = int(input())
h = [int(x) for x in input().split()]
can = True
for i in range(n):
    if i == 0:
        h[i] -= 1
    else:
        if h[i - 1] < h[i]:
            h[i] -= 1
        elif h[i - 1] == h[i]:
            continue
        else:
            can = False
print('Yes' if can else 'No')
from sys import exit
N = int(input())
H = list(map(int,input().split()))
high = H[0] - 1
for i in range(1,N):
  if H[i] < high:
    print("No")
    exit()
  elif H[i] > high: high = H[i] - 1  
print("Yes")
def readinput():
    n=int(input())
    h=list(map(int,input().split()))
    return n,h

def main(n,h):
    hr=list(reversed(h))
    for i in range(n-1):
        if hr[i]<hr[i+1]:
            if hr[i+1]-hr[i]>1:
                return 'No'
            else:
                hr[i+1]-=1
    return 'Yes'

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

print("Yes")
input()
tmp = 1
for i in map(int, input().split()):
    if tmp <= i:
        tmp = i
    elif tmp <= i + 1:
        tmp = i + 1
    else:
        print("No")
        break
else:
    print("Yes")
N = int(input())
H = list(map(int,input().split()))
safe = True
for i in reversed(range(N-1)):
  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())
h = list(map(int, input().split()))
for i in range(1, n):
    c = h[-i] - h[-(i + 1)]
    if c >= 0:
        continue
    if c == -1:
        h[-(i + 1)] -= 1
    else:
        print('No')
        break
else:
    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] or h[i]>h[i-1]:
        h[i]-=1
for i in range(n-1):
    if h[i]>h[i+1]:
        print("No")
        quit()
print("Yes")
n=int(input())
arr=list(map(int,input().split()))
for i in range(n-2,0,-1): # 列を後ろからみる
 if arr[i]>arr[i+1]: # 単調非減少になっていないとき、手前の要素の値を1減らす
   arr[i]-=1
   if arr[i]>arr[i+1]: # 1減らしても単調非減少にならないとき、答えはNo
     print('No')
     break
else:
 print('Yes')
n = int(input())
h  = list(map(int, input().split()))
h = h[::-1]
for i in range(1, n):
    if h[i-1] < h[i]-1:
        print("No")
        exit()
    elif h[i] <= h[i-1]:
        pass
    else:
        h[i] -= 1
print("Yes")
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] > 1:
    ans = "No"
    break
  elif H[i]-H[i+1] == 1 and flg == 0:
    flg = 1
  elif H[i]-H[i+1] == 1 and flg == 1:
    ans = "No"
    break
  elif H[i]-H[i+1] == 0:
    continue
  else:
    flg = 0
    continue

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

ck = False
for i in range(n-2,-1,-1):
  if h[i] > h[i+1]:
    h[i] -= 1
    if h[i] > h[i+1]:
      break
else :
  ck = True

print('Yes' if ck else 'No')
N = int(input())
H = list(map(int, input().split()))
H[0] -= 1
for i in range(1, N):
    if H[i] < H[i-1]:
        print('No')
        exit()
    elif H[i] > H[i-1]:
        H[i] -= 1
print('Yes')
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    H = list(map(int, input().split()))
    for i in range(N):
        if i == N-1:
            print("Yes")
            break
        if H [i+1] > H[i]:
            H[i+1] -= 1
        elif H[i+1] < H[i]:
            print("No")
            break

if __name__ == '__main__':
    main()
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] -= 1
if sorted(H) != H:
    print('No')
else:
    print('Yes')
N = int(input())
H = list(map(int, input().split()))
MAX = 0
for i in range(N):
    MAX = max(MAX, H[i])
    if (H[i] <= MAX - 2):
        print('No')
        exit(0)
print('Yes')
import os, sys, re, math

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

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

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

before = h[0]
for i in range(1,n):
  if before > h[i]:
    print("No")
    break
  before = max(h[i]-1, before)
else:
  print("Yes")
from sys import stdin

n = int(stdin.readline().rstrip())
h = [int(x) for x in stdin.readline().rstrip().split()]

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

for i in reversed(range(n-1)):
    if H[i] <= H[i+1]:
        continue
    elif H[i]-1 == H[i+1]:
        H[i] -= 1
    else:
        break
else:
    print('Yes')
    exit(0)
print('No')