program main
  implicit none
  integer(8) i,N,ans
  integer(8),allocatable :: H(:)
  read(*, *)N
  allocate(H(N))
  read(*, *) (H(i), i = 1,N)
  ans = 1
  H(1) = H(1)-1
  do i = 2,N
    if (H(i-1) <= H(i)-1) then
      H(i) = H(i)-1
    elseif (H(i-1) > H(i)) then
      ans = 0
    endif
  enddo
  if (ans == 1) then
    write(*, *) 'Yes'
  else
    write(*, *) 'No'
  end if
end program main

; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEh.0 = internal unnamed_addr global ptr null
@_QQcl.d429e962e6905455ff15311ca4547089 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3602/source.f\00"
@_QQcl.596573 = linkonce constant [3 x i8] c"Yes"
@_QQcl.4E6F = linkonce constant [2 x i8] c"No"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i64, align 8
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.d429e962e6905455ff15311ca4547089, i32 5)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 8)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i64, ptr %1, align 8, !tbaa !3
  %6 = call i64 @llvm.smax.i64(i64 %5, i64 0)
  %7 = shl i64 %6, 3
  %8 = call ptr @malloc(i64 %7)
  store ptr %8, ptr @_QFEh.0, align 8, !tbaa !7
  %9 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.d429e962e6905455ff15311ca4547089, i32 7)
  %10 = load i64, ptr %1, align 8, !tbaa !3
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %12 = phi i64 [ %16, %.lr.ph ], [ 1, %0 ]
  %.unpack149 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %13 = add i64 %12, -1
  %14 = getelementptr i64, ptr %.unpack149, i64 %13
  %15 = call i1 @_FortranAioInputInteger(ptr %9, ptr %14, i32 8)
  %16 = add nuw i64 %12, 1
  %exitcond.not = icmp eq i64 %12, %10
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %17 = call i32 @_FortranAioEndIoStatement(ptr %9)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %18 = load i64, ptr %.unpack, align 8, !tbaa !3
  %19 = add i64 %18, -1
  store i64 %19, ptr %.unpack, align 8, !tbaa !3
  %20 = load i64, ptr %1, align 8, !tbaa !3
  %21 = add i64 %20, -1
  %22 = icmp sgt i64 %21, 0
  br i1 %22, label %.lr.ph163, label %._crit_edge164.thread

.lr.ph163:                                        ; preds = %._crit_edge, %34
  %23 = phi i64 [ %35, %34 ], [ 2, %._crit_edge ]
  %.0161 = phi i64 [ %.1, %34 ], [ 1, %._crit_edge ]
  %24 = add i64 %23, -2
  %25 = getelementptr i64, ptr %.unpack, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !3
  %27 = add i64 %23, -1
  %28 = getelementptr i64, ptr %.unpack, i64 %27
  %29 = load i64, ptr %28, align 8, !tbaa !3
  %30 = add i64 %29, -1
  %.not = icmp sgt i64 %26, %30
  br i1 %.not, label %32, label %31

31:                                               ; preds = %.lr.ph163
  store i64 %30, ptr %28, align 8, !tbaa !3
  br label %34

32:                                               ; preds = %.lr.ph163
  %33 = icmp sgt i64 %26, %29
  %spec.select = select i1 %33, i64 0, i64 %.0161
  br label %34

34:                                               ; preds = %32, %31
  %.1 = phi i64 [ %.0161, %31 ], [ %spec.select, %32 ]
  %35 = add nuw i64 %23, 1
  %exitcond165.not = icmp eq i64 %23, %20
  br i1 %exitcond165.not, label %._crit_edge164, label %.lr.ph163

._crit_edge164:                                   ; preds = %34
  %36 = icmp eq i64 %.1, 1
  br i1 %36, label %._crit_edge164.thread, label %39

._crit_edge164.thread:                            ; preds = %._crit_edge, %._crit_edge164
  %37 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.d429e962e6905455ff15311ca4547089, i32 18)
  %38 = call i1 @_FortranAioOutputAscii(ptr %37, ptr nonnull @_QQcl.596573, i64 3)
  br label %42

39:                                               ; preds = %._crit_edge164
  %40 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.d429e962e6905455ff15311ca4547089, i32 20)
  %41 = call i1 @_FortranAioOutputAscii(ptr %40, ptr nonnull @_QQcl.4E6F, i64 2)
  br label %42

42:                                               ; preds = %._crit_edge164.thread, %39
  %.sink = phi ptr [ %37, %._crit_edge164.thread ], [ %40, %39 ]
  %43 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputInteger(ptr, ptr, i32) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #1

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
