program main
Implicit None
	integer(8)::n,i,m,p=1
	integer(8),allocatable::h(:)
	
	read*,n
	
	allocate(h(n))
	read*,h
	
	m =h(1)
	do i = 2,n
		if(m <= h(i))then
			p = p+1
			m = h(i)
		endif
	enddo
	
	print"(i0)",p
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
@_QFEp = internal unnamed_addr global i64 1
@_QQcl.853cea5f7c32f27b50f2281267020dc5 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4465/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

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca i64, align 8
  %3 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.853cea5f7c32f27b50f2281267020dc5, i32 6)
  %4 = call i1 @_FortranAioInputInteger(ptr %3, ptr nonnull %2, i32 8)
  %5 = call i32 @_FortranAioEndIoStatement(ptr %3)
  %6 = load i64, ptr %2, align 8, !tbaa !3
  %7 = call i64 @llvm.smax.i64(i64 %6, i64 0)
  %8 = shl i64 %7, 3
  %9 = call ptr @malloc(i64 %8)
  store ptr %9, ptr @_QFEh.0, align 8, !tbaa !7
  store i64 %7, ptr @_QFEh.8, align 8, !tbaa !7
  %10 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.853cea5f7c32f27b50f2281267020dc5, i32 9)
  %.unpack = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %.unpack147.unpack.unpack149 = load i64, ptr @_QFEh.8, align 8, !tbaa !7
  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 8, 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 10, 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 %.unpack147.unpack.unpack149, 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 8, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %11 = call i1 @_FortranAioInputDescriptor(ptr %10, ptr nonnull %1)
  %12 = call i32 @_FortranAioEndIoStatement(ptr %10)
  %.unpack152 = load ptr, ptr @_QFEh.0, align 8, !tbaa !7
  %13 = load i64, ptr %2, align 8, !tbaa !3
  %14 = add i64 %13, -1
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %_QFEp.promoted = load i64, ptr @_QFEp, align 8, !tbaa !3
  %16 = load i64, ptr %.unpack152, align 8, !tbaa !3
  %xtraiter = and i64 %14, 1
  %17 = icmp eq i64 %13, 2
  br i1 %17, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %14, -2
  br label %.lr.ph

.lr.ph:                                           ; preds = %30, %.lr.ph.preheader.new
  %18 = phi i64 [ 2, %.lr.ph.preheader.new ], [ %32, %30 ]
  %.0188 = phi i64 [ %16, %.lr.ph.preheader.new ], [ %.1.1, %30 ]
  %19 = phi i64 [ %_QFEp.promoted, %.lr.ph.preheader.new ], [ %31, %30 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %30 ]
  %20 = add i64 %18, -1
  %21 = getelementptr i64, ptr %.unpack152, i64 %20
  %22 = load i64, ptr %21, align 8, !tbaa !3
  %.not = icmp sgt i64 %.0188, %22
  br i1 %.not, label %.lr.ph.1, label %23

23:                                               ; preds = %.lr.ph
  %24 = add i64 %19, 1
  store i64 %24, ptr @_QFEp, align 8, !tbaa !3
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %23, %.lr.ph
  %25 = phi i64 [ %24, %23 ], [ %19, %.lr.ph ]
  %.1 = phi i64 [ %22, %23 ], [ %.0188, %.lr.ph ]
  %26 = getelementptr i64, ptr %.unpack152, i64 %18
  %27 = load i64, ptr %26, align 8, !tbaa !3
  %.not.1 = icmp sgt i64 %.1, %27
  br i1 %.not.1, label %30, label %28

28:                                               ; preds = %.lr.ph.1
  %29 = add i64 %25, 1
  store i64 %29, ptr @_QFEp, align 8, !tbaa !3
  br label %30

30:                                               ; preds = %28, %.lr.ph.1
  %31 = phi i64 [ %29, %28 ], [ %25, %.lr.ph.1 ]
  %.1.1 = phi i64 [ %27, %28 ], [ %.1, %.lr.ph.1 ]
  %32 = add nuw i64 %18, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa.loopexit, label %.lr.ph

._crit_edge.loopexit.unr-lcssa.loopexit:          ; preds = %30
  %33 = or i64 %18, 1
  br label %._crit_edge.loopexit.unr-lcssa

._crit_edge.loopexit.unr-lcssa:                   ; preds = %._crit_edge.loopexit.unr-lcssa.loopexit, %.lr.ph.preheader
  %.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %33, %._crit_edge.loopexit.unr-lcssa.loopexit ]
  %.0188.unr = phi i64 [ %16, %.lr.ph.preheader ], [ %.1.1, %._crit_edge.loopexit.unr-lcssa.loopexit ]
  %.unr189 = phi i64 [ %_QFEp.promoted, %.lr.ph.preheader ], [ %31, %._crit_edge.loopexit.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %34 = getelementptr i64, ptr %.unpack152, i64 %.unr
  %35 = load i64, ptr %34, align 8, !tbaa !3
  %.not.epil = icmp sgt i64 %.0188.unr, %35
  br i1 %.not.epil, label %._crit_edge, label %36

36:                                               ; preds = %.lr.ph.epil
  %37 = add i64 %.unr189, 1
  store i64 %37, ptr @_QFEp, align 8, !tbaa !3
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %36, %.lr.ph.epil, %0
  %38 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.853cea5f7c32f27b50f2281267020dc5, i32 19)
  %39 = load i64, ptr @_QFEp, align 8, !tbaa !3
  %40 = call i1 @_FortranAioOutputInteger64(ptr %38, i64 %39)
  %41 = call i32 @_FortranAioEndIoStatement(ptr %38)
  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 @_FortranAioOutputInteger64(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}
