import sys

N=int(eval(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")



import sys

N=int(eval(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")



import sys

N = int(eval(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")

import sys

N = int(eval(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")

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