program main
  implicit none
  integer :: N
  integer,allocatable :: H(:)
  logical :: flag
  integer :: out
  integer :: i,j
  read(*,*) N
  allocate(H(N))
  read(*,*) H(:)

  out = 1
  do I = 2,N
     flag=.true.
     do j = 1,i-1
        if (H(j) > H(i)) then
           flag=.false.
           exit
        end if
     end do
     if (flag) then
        out = out+1
     end if
  end do
  write(*,'(i0)') out
  stop 
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.2101081776ef1d8b19ab9c4992d95663 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4479/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_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

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #1 {
  %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.2101081776ef1d8b19ab9c4992d95663, i32 8)
  %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.2101081776ef1d8b19ab9c4992d95663, i32 10)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack99.unpack.unpack101 = load i64, ptr @_QFEh.8, align 8, !tbaa !7
  %12 = call i64 @llvm.smax.i64(i64 %.unpack99.unpack.unpack101, 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)
  %15 = load i32, ptr %2, align 4, !tbaa !3
  %.082121 = add i32 %15, -1
  %16 = icmp sgt i32 %.082121, 0
  br i1 %16, label %.preheader.lr.ph, label %._crit_edge125

.preheader.lr.ph:                                 ; preds = %0
  %.unpack104 = load ptr, ptr @_QFEh.0, align 8
  br label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge
  %.0123 = phi i32 [ 1, %.preheader.lr.ph ], [ %spec.select, %._crit_edge ]
  %.080122 = phi i32 [ 2, %.preheader.lr.ph ], [ %33, %._crit_edge ]
  %.083116 = add i32 %.080122, -1
  %17 = icmp slt i32 %.083116, 1
  br i1 %17, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %18 = sext i32 %.080122 to i64
  %19 = add nsw i64 %18, -1
  %20 = getelementptr i32, ptr %.unpack104, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !3
  %22 = load i32, ptr %.unpack104, align 4, !tbaa !3
  %23 = icmp sgt i32 %22, %21
  br i1 %23, label %._crit_edge, label %.lr.ph130

.lr.ph130:                                        ; preds = %.lr.ph, %25
  %.079117129 = phi i32 [ %24, %25 ], [ 1, %.lr.ph ]
  %.083118128 = phi i32 [ %.083, %25 ], [ %.083116, %.lr.ph ]
  %24 = add nuw i32 %.079117129, 1
  %.083 = add i32 %.083118128, -1
  %exitcond = icmp eq i32 %24, %.080122
  br i1 %exitcond, label %._crit_edge.loopexit, label %25

25:                                               ; preds = %.lr.ph130
  %26 = sext i32 %24 to i64
  %27 = add nsw i64 %26, -1
  %28 = getelementptr i32, ptr %.unpack104, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !3
  %30 = icmp sgt i32 %29, %21
  br i1 %30, label %._crit_edge.loopexit, label %.lr.ph130

._crit_edge.loopexit:                             ; preds = %.lr.ph130, %25
  %31 = icmp slt i32 %.083, 1
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph, %.preheader
  %.lcssa = phi i1 [ true, %.preheader ], [ false, %.lr.ph ], [ %31, %._crit_edge.loopexit ]
  %32 = zext i1 %.lcssa to i32
  %spec.select = add i32 %.0123, %32
  %33 = add nuw i32 %.080122, 1
  %exitcond127.not = icmp eq i32 %.080122, %15
  br i1 %exitcond127.not, label %._crit_edge125, label %.preheader

._crit_edge125:                                   ; preds = %._crit_edge, %0
  %.0.lcssa = phi i32 [ 1, %0 ], [ %spec.select, %._crit_edge ]
  %34 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.2101081776ef1d8b19ab9c4992d95663, i32 25)
  %35 = call i1 @_FortranAioOutputInteger32(ptr %34, i32 %.0.lcssa)
  %36 = call i32 @_FortranAioEndIoStatement(ptr %34)
  %37 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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 @_FortranAioOutputInteger32(ptr, i32) 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) #2

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
attributes #1 = { noreturn }
attributes #2 = { 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}
