program contests
  implicit none
  integer              :: n, a, b
  integer, allocatable :: p(:)
  integer              :: m(3), i
  read(*,*) n
  read(*,*) a, b
  allocate(p(n))
  read(*,*) p(:)
  m = 0
  do i = 1, n
     if (p(i) .le. a) then
        m(1) = m(1) + 1
     else if (p(i) .le. b) then
        m(2) = m(2) + 1
     else
        m(3) = m(3) + 1
     end if
  end do
  deallocate(p)
  write(*,'(i0)') minval(m)
  stop
end program contests
; 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"

@_QFEp.0 = internal unnamed_addr global ptr null
@_QFEp.8 = internal unnamed_addr global i64 0
@_QQcl.adfd6fdd57eb8414f467817df40a07ff = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5143/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: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #2 {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [3 x i32], align 4
  %6 = alloca i32, align 4
  %7 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.adfd6fdd57eb8414f467817df40a07ff, i32 6)
  %8 = call i1 @_FortranAioInputInteger(ptr %7, ptr nonnull %6, i32 4)
  %9 = call i32 @_FortranAioEndIoStatement(ptr %7)
  %10 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.adfd6fdd57eb8414f467817df40a07ff, i32 7)
  %11 = call i1 @_FortranAioInputInteger(ptr %10, ptr nonnull %3, i32 4)
  %12 = call i1 @_FortranAioInputInteger(ptr %10, ptr nonnull %4, i32 4)
  %13 = call i32 @_FortranAioEndIoStatement(ptr %10)
  %14 = load i32, ptr %6, align 4, !tbaa !3
  %15 = call i32 @llvm.smax.i32(i32 %14, i32 0)
  %16 = zext i32 %15 to i64
  %17 = shl nuw nsw i64 %16, 2
  %18 = call ptr @malloc(i64 %17)
  store ptr %18, ptr @_QFEp.0, align 8, !tbaa !7
  store i64 %16, ptr @_QFEp.8, align 8, !tbaa !7
  %19 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.adfd6fdd57eb8414f467817df40a07ff, i32 9)
  %.unpack = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %.unpack206.unpack.unpack208 = load i64, ptr @_QFEp.8, align 8, !tbaa !7
  %20 = call i64 @llvm.smax.i64(i64 %.unpack206.unpack.unpack208, i64 0)
  store ptr %.unpack, ptr %2, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %2, 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 %2, 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 %2, 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 %2, 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 %2, 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 %2, 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 %2, 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 %2, i64 0, i32 7, i64 0, i64 1
  store i64 %20, 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 %2, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %21 = call i1 @_FortranAioInputDescriptor(ptr %19, ptr nonnull %2)
  %22 = call i32 @_FortranAioEndIoStatement(ptr %19)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %5, i8 0, i64 12, i1 false), !tbaa !3
  %23 = load i32, ptr %6, align 4, !tbaa !3
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.unpack211.pre = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  br label %._crit_edge

.lr.ph:                                           ; preds = %0
  %25 = zext i32 %23 to i64
  %.unpack223 = load ptr, ptr @_QFEp.0, align 8, !tbaa !7
  %26 = load i32, ptr %3, align 4, !tbaa !3
  %27 = load i32, ptr %4, align 4
  %28 = getelementptr inbounds [3 x i32], ptr %5, i64 0, i64 1
  %29 = getelementptr inbounds [3 x i32], ptr %5, i64 0, i64 2
  br label %30

30:                                               ; preds = %.lr.ph, %44
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %44 ]
  %31 = phi i32 [ 0, %.lr.ph ], [ %45, %44 ]
  %32 = phi i32 [ 0, %.lr.ph ], [ %46, %44 ]
  %33 = phi i32 [ 0, %.lr.ph ], [ %47, %44 ]
  %34 = add nsw i64 %indvars.iv, -1
  %35 = getelementptr i32, ptr %.unpack223, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !3
  %.not = icmp sgt i32 %36, %26
  br i1 %.not, label %39, label %37

37:                                               ; preds = %30
  %38 = add i32 %33, 1
  store i32 %38, ptr %5, align 4, !tbaa !3
  br label %44

39:                                               ; preds = %30
  %.not235 = icmp sgt i32 %36, %27
  br i1 %.not235, label %42, label %40

40:                                               ; preds = %39
  %41 = add i32 %32, 1
  store i32 %41, ptr %28, align 4, !tbaa !3
  br label %44

42:                                               ; preds = %39
  %43 = add i32 %31, 1
  store i32 %43, ptr %29, align 4, !tbaa !3
  br label %44

44:                                               ; preds = %37, %40, %42
  %45 = phi i32 [ %31, %37 ], [ %31, %40 ], [ %43, %42 ]
  %46 = phi i32 [ %32, %37 ], [ %41, %40 ], [ %32, %42 ]
  %47 = phi i32 [ %38, %37 ], [ %33, %40 ], [ %33, %42 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %25
  br i1 %exitcond.not, label %._crit_edge, label %30

._crit_edge:                                      ; preds = %44, %.._crit_edge_crit_edge
  %.unpack211 = phi ptr [ %.unpack211.pre, %.._crit_edge_crit_edge ], [ %.unpack223, %44 ]
  call void @free(ptr %.unpack211)
  store ptr null, ptr @_QFEp.0, align 8, !tbaa !7
  store i64 0, ptr @_QFEp.8, align 8, !tbaa !7
  %48 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.adfd6fdd57eb8414f467817df40a07ff, i32 21)
  store ptr %5, ptr %1, align 8, !tbaa !7
  %.fca.1.gep112 = 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.gep112, align 8, !tbaa !7
  %.fca.2.gep114 = 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.gep114, align 8, !tbaa !7
  %.fca.3.gep116 = 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.gep116, align 4, !tbaa !7
  %.fca.4.gep118 = 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.gep118, align 1, !tbaa !7
  %.fca.5.gep120 = 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.gep120, align 2, !tbaa !7
  %.fca.6.gep122 = 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.gep122, align 1, !tbaa !7
  %.fca.7.0.0.gep124 = 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.gep124, align 8, !tbaa !7
  %.fca.7.0.1.gep126 = 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 3, ptr %.fca.7.0.1.gep126, align 8, !tbaa !7
  %.fca.7.0.2.gep128 = 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.gep128, align 8, !tbaa !7
  %49 = call i32 @_FortranAMinvalInteger4(ptr nonnull %1, ptr nonnull @_QQcl.adfd6fdd57eb8414f467817df40a07ff, i32 21, i32 0, ptr null)
  %50 = call i1 @_FortranAioOutputInteger32(ptr %48, i32 %49)
  %51 = call i32 @_FortranAioEndIoStatement(ptr %48)
  %52 = 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 i32 @_FortranAMinvalInteger4(ptr, ptr, i32, i32, ptr) 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) #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

!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}
