program main
  implicit none
  integer :: n, i, x
  integer, allocatable :: h(:)
  read (*, *) n
  allocate (h(n))
  read (*, *) h(:)
  x = h(n)
  do i = n - 1, 1, -1
    if (h(i) <= x) then
      continue
    else if (h(i) == x + 1) then
      h(i) = x
    else
      write (*, "(a)") "No"
      stop
    end if
    x = h(i)
  end do
  write (*, "(a)") "Yes"
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
@_QFEh.8 = internal unnamed_addr global i64 0
@_QQcl.9cab08d974057d4c178abc2ee27888a4 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3601/source.f\00"
@_QQcl.286129 = linkonce constant [3 x i8] c"(a)"
@_QQcl.4E6F = linkonce constant [2 x i8] c"No"
@_QQcl.596573 = linkonce constant [3 x i8] c"Yes"
@_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 { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i32, align 4
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9cab08d974057d4c178abc2ee27888a4, i32 5)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 4)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i32, ptr %2, align 4, !tbaa !3
  %7 = call i32 @llvm.smax.i32(i32 %6, i32 0)
  %8 = zext i32 %7 to i64
  %9 = shl nuw nsw i64 %8, 2
  %10 = call ptr @malloc(i64 %9)
  store ptr %10, ptr @_QFEh.0, align 8, !tbaa !7
  store i64 %8, ptr @_QFEh.8, align 8, !tbaa !7
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9cab08d974057d4c178abc2ee27888a4, i32 7)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack215.unpack.unpack217 = load i64, ptr @_QFEh.8, align 8, !tbaa !7
  %12 = call i64 @llvm.smax.i64(i64 %.unpack215.unpack.unpack217, i64 0)
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %12, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %13 = call i1 @_FortranAioInputDescriptor(ptr %11, ptr nonnull %1)
  %14 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %.unpack220 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %15 = load i32, ptr %2, align 4, !tbaa !3
  %.0198256 = add i32 %15, -1
  %16 = icmp sgt i32 %.0198256, 0
  br i1 %16, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %17 = sext i32 %15 to i64
  %18 = add nsw i64 %17, -1
  %19 = getelementptr i32, ptr %.unpack220, i64 %18
  %.0260.pre = load i32, ptr %19, align 4, !tbaa !3
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %33
  %.0260 = phi i32 [ %.0260262, %33 ], [ %.0260.pre, %.lr.ph.preheader ]
  %.0197261.in = phi i32 [ %.0197261, %33 ], [ %15, %.lr.ph.preheader ]
  %.0198259 = phi i32 [ %.0198, %33 ], [ %.0198256, %.lr.ph.preheader ]
  %.0197261 = add i32 %.0197261.in, -1
  %20 = sext i32 %.0197261 to i64
  %21 = add nsw i64 %20, -1
  %22 = getelementptr i32, ptr %.unpack220, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !3
  %.not = icmp sgt i32 %23, %.0260
  br i1 %.not, label %24, label %33

24:                                               ; preds = %.lr.ph
  %25 = add nsw i32 %.0260, 1
  %26 = icmp eq i32 %23, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  store i32 %.0260, ptr %22, align 4, !tbaa !3
  br label %33

28:                                               ; preds = %24
  %29 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.9cab08d974057d4c178abc2ee27888a4, i32 15)
  %30 = call i1 @_FortranAioOutputAscii(ptr %29, ptr nonnull @_QQcl.4E6F, i64 2)
  %31 = call i32 @_FortranAioEndIoStatement(ptr %29)
  %32 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

33:                                               ; preds = %27, %.lr.ph
  %.0260262 = phi i32 [ %.0260, %27 ], [ %23, %.lr.ph ]
  %.0198 = add i32 %.0198259, -1
  %34 = icmp sgt i32 %.0198, 0
  br i1 %34, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %33, %0
  %35 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.286129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.9cab08d974057d4c178abc2ee27888a4, i32 20)
  %36 = call i1 @_FortranAioOutputAscii(ptr %35, ptr nonnull @_QQcl.596573, i64 3)
  %37 = call i32 @_FortranAioEndIoStatement(ptr %35)
  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 i1 @_FortranAioInputDescriptor(ptr, ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

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

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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}
