program B081
    implicit none
    integer(8) :: N
    integer(8), allocatable, dimension(:) :: A
    integer(8) :: i, j, sum

    read(5,*) N
    allocate(A(N))
    read(5,*) (A(i), i = 1, N)
    sum = 0

    j = 0
    do while (j == 0)
        do i = 1, N
            if (mod(A(i),2) == 0) then
                A(i) = A(i) / 2
            else
                j = j + 1
            end if


        end do
        if (j == 0) then
            sum = sum + 1
        end if



    end do


    write(6,*) sum




end program B081
; 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"

@_QFEa.0 = internal unnamed_addr global ptr null
@_QQcl.bceddd69db20b18947da4daa52cec163 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_6622/source.f\00"
@_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 i64, align 8
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.bceddd69db20b18947da4daa52cec163, i32 7)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 8)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = load i64, ptr %1, align 8, !tbaa !3
  %6 = call i64 @llvm.smax.i64(i64 %5, i64 0)
  %7 = shl i64 %6, 3
  %8 = call ptr @malloc(i64 %7)
  store ptr %8, ptr @_QFEa.0, align 8, !tbaa !7
  %9 = call ptr @_FortranAioBeginExternalListInput(i32 5, ptr nonnull @_QQcl.bceddd69db20b18947da4daa52cec163, i32 9)
  %10 = load i64, ptr %1, align 8, !tbaa !3
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %12 = phi i64 [ %16, %.lr.ph ], [ 1, %0 ]
  %.unpack99 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %13 = add i64 %12, -1
  %14 = getelementptr i64, ptr %.unpack99, i64 %13
  %15 = call i1 @_FortranAioInputInteger(ptr %9, ptr %14, i32 8)
  %16 = add nuw i64 %12, 1
  %exitcond.not = icmp eq i64 %12, %10
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %17 = call i32 @_FortranAioEndIoStatement(ptr %9)
  %.unpack = load ptr, ptr @_QFEa.0, align 8
  %18 = load i64, ptr %1, align 8, !tbaa !3
  %19 = icmp sgt i64 %18, 0
  br i1 %19, label %.split, label %.split.us.split

.split.us.split:                                  ; preds = %._crit_edge, %.split.us.split
  br label %.split.us.split

.splitthread-pre-split:                           ; preds = %._crit_edge115.thread, %._crit_edge115
  %spec.select111122 = phi i64 [ %spec.select111121, %._crit_edge115.thread ], [ %spec.select111, %._crit_edge115 ]
  %.pr = load i64, ptr %1, align 8, !tbaa !3
  br label %.split

.split:                                           ; preds = %._crit_edge, %.splitthread-pre-split
  %20 = phi i64 [ %.pr, %.splitthread-pre-split ], [ %18, %._crit_edge ]
  %.0116 = phi i64 [ %spec.select111122, %.splitthread-pre-split ], [ 0, %._crit_edge ]
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %.lr.ph114, label %._crit_edge115.thread

._crit_edge115.thread:                            ; preds = %.split
  %spec.select111121 = add i64 %.0116, 1
  br label %.splitthread-pre-split

.lr.ph114:                                        ; preds = %.split, %32
  %22 = phi i64 [ %33, %32 ], [ 1, %.split ]
  %.1112 = phi i64 [ %.2, %32 ], [ 0, %.split ]
  %23 = add i64 %22, -1
  %24 = getelementptr i64, ptr %.unpack, i64 %23
  %25 = load i64, ptr %24, align 8, !tbaa !3
  %26 = and i64 %25, 1
  %27 = icmp eq i64 %26, 0
  br i1 %27, label %28, label %30

28:                                               ; preds = %.lr.ph114
  %29 = sdiv i64 %25, 2
  store i64 %29, ptr %24, align 8, !tbaa !3
  br label %32

30:                                               ; preds = %.lr.ph114
  %31 = add i64 %.1112, 1
  br label %32

32:                                               ; preds = %28, %30
  %.2 = phi i64 [ %.1112, %28 ], [ %31, %30 ]
  %33 = add nuw i64 %22, 1
  %exitcond119.not = icmp eq i64 %22, %20
  br i1 %exitcond119.not, label %._crit_edge115, label %.lr.ph114

._crit_edge115:                                   ; preds = %32
  %34 = icmp eq i64 %.2, 0
  %35 = zext i1 %34 to i64
  %spec.select111 = add i64 %.0116, %35
  br i1 %34, label %.splitthread-pre-split, label %.split118, !llvm.loop !9

.split118:                                        ; preds = %._crit_edge115
  %36 = call ptr @_FortranAioBeginExternalListOutput(i32 6, ptr nonnull @_QQcl.bceddd69db20b18947da4daa52cec163, i32 32)
  %37 = call i1 @_FortranAioOutputInteger64(ptr %36, i64 %spec.select111)
  %38 = call i32 @_FortranAioEndIoStatement(ptr %36)
  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 @_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}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unswitch.partial.disable"}
