program main
  implicit none
  
  integer ::n, h(20), c=1,i,j,y
  
  read(*,*)n
  read(*,*)(h(i),i=1,n)
  
  if (n == 1) then
    write(*,*)c
    stop
  end if
  
  do i = 2, n
    y = 1
    do j = 1, i
      if (h(j) > h(i)) then
        y = 0
      end if
    end do
    if (y == 1) then
      c = c + 1
    end if
  end do
  
  write(*,*)c
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"

@_QFEc = internal unnamed_addr global i32 1
@_QFEh = internal global [20 x i32] undef
@_QQcl.a2ad3678aae9e0b40a70d34d552f60a3 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4477/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a2ad3678aae9e0b40a70d34d552f60a3, i32 6)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.a2ad3678aae9e0b40a70d34d552f60a3, i32 7)
  %6 = load i32, ptr %1, align 4, !tbaa !3
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %8 = zext i32 %6 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %9 = phi i64 [ %14, %.lr.ph ], [ 1, %.lr.ph.preheader ]
  %sext = shl i64 %9, 32
  %10 = ashr exact i64 %sext, 32
  %11 = add nsw i64 %10, -1
  %12 = getelementptr [20 x i32], ptr @_QFEh, i64 0, i64 %11
  %13 = call i1 @_FortranAioInputInteger(ptr %5, ptr %12, i32 4)
  %14 = add nuw nsw i64 %9, 1
  %exitcond.not = icmp eq i64 %9, %8
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %15 = call i32 @_FortranAioEndIoStatement(ptr %5)
  %16 = load i32, ptr %1, align 4, !tbaa !3
  %17 = icmp eq i32 %16, 1
  br i1 %17, label %18, label %24

18:                                               ; preds = %._crit_edge
  %19 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.a2ad3678aae9e0b40a70d34d552f60a3, i32 10)
  %20 = load i32, ptr @_QFEc, align 4, !tbaa !3
  %21 = call i1 @_FortranAioOutputInteger32(ptr %19, i32 %20)
  %22 = call i32 @_FortranAioEndIoStatement(ptr %19)
  %23 = call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable

24:                                               ; preds = %._crit_edge
  %25 = icmp sgt i32 %16, 1
  br i1 %25, label %.lr.ph16.preheader, label %._crit_edge17

.lr.ph16.preheader:                               ; preds = %24
  %_QFEc.promoted = load i32, ptr @_QFEc, align 4, !tbaa !3
  %26 = zext i32 %16 to i64
  br label %.lr.ph13

.lr.ph13:                                         ; preds = %47, %.lr.ph16.preheader
  %indvar = phi i64 [ %indvar.next, %47 ], [ 0, %.lr.ph16.preheader ]
  %indvars.iv22 = phi i64 [ %indvars.iv.next23, %47 ], [ 2, %.lr.ph16.preheader ]
  %indvars.iv19 = phi i64 [ %indvars.iv.next20, %47 ], [ 3, %.lr.ph16.preheader ]
  %27 = phi i32 [ %48, %47 ], [ %_QFEc.promoted, %.lr.ph16.preheader ]
  %28 = add i64 %indvar, 2
  %29 = add nsw i64 %indvars.iv22, -1
  %30 = getelementptr [20 x i32], ptr @_QFEh, i64 0, i64 %29
  %31 = load i32, ptr %30, align 4, !tbaa !3
  %min.iters.check = icmp ult i64 %28, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph13
  %n.vec = and i64 %28, -8
  %ind.end = or i64 %n.vec, 1
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %31, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert28 = insertelement <4 x i32> poison, i32 %31, i64 0
  %broadcast.splat29 = shufflevector <4 x i32> %broadcast.splatinsert28, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %36, %vector.body ]
  %vec.phi26 = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %vector.ph ], [ %37, %vector.body ]
  %32 = getelementptr [20 x i32], ptr @_QFEh, i64 0, i64 %index
  %wide.load = load <4 x i32>, ptr %32, align 16, !tbaa !3
  %33 = getelementptr i32, ptr %32, i64 4
  %wide.load27 = load <4 x i32>, ptr %33, align 16, !tbaa !3
  %34 = icmp sgt <4 x i32> %wide.load, %broadcast.splat
  %35 = icmp sgt <4 x i32> %wide.load27, %broadcast.splat29
  %36 = select <4 x i1> %34, <4 x i32> zeroinitializer, <4 x i32> %vec.phi
  %37 = select <4 x i1> %35, <4 x i32> zeroinitializer, <4 x i32> %vec.phi26
  %index.next = add nuw i64 %index, 8
  %38 = icmp eq i64 %index.next, %n.vec
  br i1 %38, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %rdx.select.cmp.not = icmp ne <4 x i32> %36, <i32 1, i32 1, i32 1, i32 1>
  %rdx.select.cmp3032 = icmp ne <4 x i32> %37, <i32 1, i32 1, i32 1, i32 1>
  %rdx.select.cmp30 = select <4 x i1> %rdx.select.cmp.not, <4 x i1> <i1 true, i1 true, i1 true, i1 true>, <4 x i1> %rdx.select.cmp3032
  %39 = bitcast <4 x i1> %rdx.select.cmp30 to i4
  %.not = icmp eq i4 %39, 0
  %rdx.select31 = zext i1 %.not to i32
  %cmp.n = icmp eq i64 %28, %n.vec
  br i1 %cmp.n, label %._crit_edge14, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph13, %middle.block
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph13 ], [ %ind.end, %middle.block ]
  %.011.ph = phi i32 [ 1, %.lr.ph13 ], [ %rdx.select31, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %.011 = phi i32 [ %spec.select, %scalar.ph ], [ %.011.ph, %scalar.ph.preheader ]
  %40 = add nsw i64 %indvars.iv, -1
  %41 = getelementptr [20 x i32], ptr @_QFEh, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !3
  %43 = icmp sgt i32 %42, %31
  %spec.select = select i1 %43, i32 0, i32 %.011
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond21.not = icmp eq i64 %indvars.iv.next, %indvars.iv19
  br i1 %exitcond21.not, label %._crit_edge14, label %scalar.ph, !llvm.loop !10

._crit_edge14:                                    ; preds = %scalar.ph, %middle.block
  %spec.select.lcssa = phi i32 [ %rdx.select31, %middle.block ], [ %spec.select, %scalar.ph ]
  %44 = icmp eq i32 %spec.select.lcssa, 1
  br i1 %44, label %45, label %47

45:                                               ; preds = %._crit_edge14
  %46 = add i32 %27, 1
  store i32 %46, ptr @_QFEc, align 4, !tbaa !3
  br label %47

47:                                               ; preds = %45, %._crit_edge14
  %48 = phi i32 [ %46, %45 ], [ %27, %._crit_edge14 ]
  %indvars.iv.next23 = add nuw nsw i64 %indvars.iv22, 1
  %indvars.iv.next20 = add nuw nsw i64 %indvars.iv19, 1
  %exitcond25.not = icmp eq i64 %indvars.iv22, %26
  %indvar.next = add i64 %indvar, 1
  br i1 %exitcond25.not, label %._crit_edge17, label %.lr.ph13

._crit_edge17:                                    ; preds = %47, %24
  %49 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.a2ad3678aae9e0b40a70d34d552f60a3, i32 26)
  %50 = load i32, ptr @_QFEc, align 4, !tbaa !3
  %51 = call i1 @_FortranAioOutputInteger32(ptr %49, i32 %50)
  %52 = call i32 @_FortranAioEndIoStatement(ptr %49)
  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 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

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

!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 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = distinct !{!10, !9, !8}
