program A319D
    implicit none
    integer(8)::N,calc,i,j,bcount
    integer(8),allocatable,dimension(:)::A,ans
    read*,N
    allocate(A(N))
    allocate(ans(N))
    read*,A
    ans=0
    bcount=0
    do i=0,N-1
        calc=0
        do j=1,N/(N-i)
            calc=calc+ans(j*(N-i))
        end do
        if(A(N-i)==0)then
            if(mod(calc,2)==1)then
                ans(N-i)=1
                bcount=bcount+1
            end if
        else
            if(mod(calc,2)==0)then
                ans(N-i)=1
                bcount=bcount+1
            end if
        end if
    end do

    print'(i0)',bcount
    do i=1,N
        if(ans(i)==1)write(*,fmt='(i0,1x)',advance='no')i
    end do
    print'(A)',""
end program A319D
; 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
@_QFEa.8 = internal unnamed_addr global i64 0
@_QFEans.0 = internal unnamed_addr global ptr null
@_QFEans.7 = internal unnamed_addr global i64 1
@_QFEans.8 = internal unnamed_addr global i64 0
@_QQcl.deff46d2c9823245e8b485001751cb1c = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3752/source.f\00"
@_QQcl.16373402fa3425c6e46827601abb88fa = linkonce constant [76 x i8] c"array left hand side must be allocated when the right hand side is a scalar\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQcl.2869302C317829 = linkonce constant [7 x i8] c"(i0,1x)"
@_QQcl.6E6F = linkonce constant [2 x i8] c"no"
@_QQcl.284129 = linkonce constant [3 x i8] c"(A)"
@_QQcl. = linkonce constant [0 x i8] zeroinitializer
@_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.deff46d2c9823245e8b485001751cb1c, i32 5)
  %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 @_QFEa.0, align 8, !tbaa !7
  store i64 %7, ptr @_QFEa.8, align 8, !tbaa !7
  %10 = call ptr @malloc(i64 %8)
  store ptr %10, ptr @_QFEans.0, align 8, !tbaa !7
  store i64 1, ptr @_QFEans.7, align 8, !tbaa !7
  store i64 %7, ptr @_QFEans.8, align 8, !tbaa !7
  %11 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.deff46d2c9823245e8b485001751cb1c, i32 8)
  %.unpack = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  %.unpack383.unpack.unpack385 = load i64, ptr @_QFEa.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 %.unpack383.unpack.unpack385, 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
  %12 = call i1 @_FortranAioInputDescriptor(ptr %11, ptr nonnull %1)
  %13 = call i32 @_FortranAioEndIoStatement(ptr %11)
  %.unpack388 = load ptr, ptr @_QFEans.0, align 8, !tbaa !7
  %.unpack395.unpack.unpack397 = load i64, ptr @_QFEans.8, align 8, !tbaa !7
  %.not = icmp eq ptr %.unpack388, null
  br i1 %.not, label %16, label %.preheader

.preheader:                                       ; preds = %0
  %14 = icmp sgt i64 %.unpack395.unpack.unpack397, 0
  br i1 %14, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader
  %15 = shl nuw i64 %.unpack395.unpack.unpack397, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 8 %.unpack388, i8 0, i64 %15, i1 false), !tbaa !3
  br label %.loopexit

16:                                               ; preds = %0
  %17 = call {} @_FortranAReportFatalUserError(ptr nonnull @_QQcl.16373402fa3425c6e46827601abb88fa, ptr nonnull @_QQcl.deff46d2c9823245e8b485001751cb1c, i32 9)
  %.unpack467.unpack.unpack = load i64, ptr @_QFEans.7, align 8, !tbaa !7
  %18 = icmp eq i64 %.unpack395.unpack.unpack397, 0
  %19 = select i1 %18, i64 1, i64 %.unpack467.unpack.unpack
  store ptr null, ptr @_QFEans.0, align 8, !tbaa !7
  store i64 %19, ptr @_QFEans.7, align 8, !tbaa !7
  store i64 %.unpack395.unpack.unpack397, ptr @_QFEans.8, align 8, !tbaa !7
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph.preheader, %.preheader, %16
  %20 = load i64, ptr %2, align 8, !tbaa !3
  %21 = icmp sgt i64 %20, 0
  br i1 %21, label %.lr.ph485, label %._crit_edge486

.lr.ph485:                                        ; preds = %.loopexit
  %.unpack455.unpack.unpack = load i64, ptr @_QFEans.7, align 8
  %.unpack412 = load ptr, ptr @_QFEa.0, align 8, !tbaa !7
  br label %22

22:                                               ; preds = %.lr.ph485, %74
  %23 = phi i64 [ 0, %.lr.ph485 ], [ %75, %74 ]
  %.0354483 = phi i64 [ 0, %.lr.ph485 ], [ %.1, %74 ]
  %24 = load i64, ptr %2, align 8, !tbaa !3
  %25 = sub i64 %24, %23
  %26 = sdiv i64 %24, %25
  %27 = icmp sgt i64 %26, 0
  br i1 %27, label %.lr.ph482.preheader, label %._crit_edge

.lr.ph482.preheader:                              ; preds = %22
  %xtraiter = and i64 %26, 3
  %28 = icmp ult i64 %26, 4
  br i1 %28, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph482.preheader.new

.lr.ph482.preheader.new:                          ; preds = %.lr.ph482.preheader
  %unroll_iter = and i64 %26, -4
  br label %.lr.ph482

.lr.ph482:                                        ; preds = %.lr.ph482, %.lr.ph482.preheader.new
  %29 = phi i64 [ 1, %.lr.ph482.preheader.new ], [ %53, %.lr.ph482 ]
  %.0481 = phi i64 [ 0, %.lr.ph482.preheader.new ], [ %52, %.lr.ph482 ]
  %niter = phi i64 [ 0, %.lr.ph482.preheader.new ], [ %niter.next.3, %.lr.ph482 ]
  %30 = mul i64 %29, %25
  %31 = sub i64 %30, %.unpack455.unpack.unpack
  %32 = getelementptr i64, ptr %.unpack388, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !3
  %34 = add i64 %33, %.0481
  %35 = add nuw nsw i64 %29, 1
  %36 = mul i64 %35, %25
  %37 = sub i64 %36, %.unpack455.unpack.unpack
  %38 = getelementptr i64, ptr %.unpack388, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !3
  %40 = add i64 %39, %34
  %41 = add nuw nsw i64 %29, 2
  %42 = mul i64 %41, %25
  %43 = sub i64 %42, %.unpack455.unpack.unpack
  %44 = getelementptr i64, ptr %.unpack388, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !3
  %46 = add i64 %45, %40
  %47 = add nuw i64 %29, 3
  %48 = mul i64 %47, %25
  %49 = sub i64 %48, %.unpack455.unpack.unpack
  %50 = getelementptr i64, ptr %.unpack388, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !3
  %52 = add i64 %51, %46
  %53 = add nuw i64 %29, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph482

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph482, %.lr.ph482.preheader
  %.lcssa.ph = phi i64 [ undef, %.lr.ph482.preheader ], [ %52, %.lr.ph482 ]
  %.unr = phi i64 [ 1, %.lr.ph482.preheader ], [ %53, %.lr.ph482 ]
  %.0481.unr = phi i64 [ 0, %.lr.ph482.preheader ], [ %52, %.lr.ph482 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph482.epil

.lr.ph482.epil:                                   ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph482.epil
  %54 = phi i64 [ %60, %.lr.ph482.epil ], [ %.unr, %._crit_edge.loopexit.unr-lcssa ]
  %.0481.epil = phi i64 [ %59, %.lr.ph482.epil ], [ %.0481.unr, %._crit_edge.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph482.epil ], [ 0, %._crit_edge.loopexit.unr-lcssa ]
  %55 = mul i64 %54, %25
  %56 = sub i64 %55, %.unpack455.unpack.unpack
  %57 = getelementptr i64, ptr %.unpack388, i64 %56
  %58 = load i64, ptr %57, align 8, !tbaa !3
  %59 = add i64 %58, %.0481.epil
  %60 = add nuw i64 %54, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.lr.ph482.epil, !llvm.loop !9

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph482.epil, %22
  %.0.lcssa = phi i64 [ 0, %22 ], [ %.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %59, %.lr.ph482.epil ]
  %61 = add i64 %25, -1
  %62 = getelementptr i64, ptr %.unpack412, i64 %61
  %63 = load i64, ptr %62, align 8, !tbaa !3
  %64 = icmp eq i64 %63, 0
  br i1 %64, label %65, label %68

65:                                               ; preds = %._crit_edge
  %66 = and i64 %.0.lcssa, -9223372036854775807
  %67 = icmp eq i64 %66, 1
  br i1 %67, label %.sink.split, label %74

68:                                               ; preds = %._crit_edge
  %69 = and i64 %.0.lcssa, 1
  %70 = icmp eq i64 %69, 0
  br i1 %70, label %.sink.split, label %74

.sink.split:                                      ; preds = %68, %65
  %71 = sub i64 %25, %.unpack455.unpack.unpack
  %72 = getelementptr i64, ptr %.unpack388, i64 %71
  store i64 1, ptr %72, align 8, !tbaa !3
  %73 = add i64 %.0354483, 1
  br label %74

74:                                               ; preds = %.sink.split, %65, %68
  %.1 = phi i64 [ %.0354483, %65 ], [ %.0354483, %68 ], [ %73, %.sink.split ]
  %75 = add nuw i64 %23, 1
  %exitcond491.not = icmp eq i64 %75, %20
  br i1 %exitcond491.not, label %._crit_edge486, label %22

._crit_edge486:                                   ; preds = %74, %.loopexit
  %.0354.lcssa = phi i64 [ 0, %.loopexit ], [ %.1, %74 ]
  %76 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.deff46d2c9823245e8b485001751cb1c, i32 29)
  %77 = call i1 @_FortranAioOutputInteger64(ptr %76, i64 %.0354.lcssa)
  %78 = call i32 @_FortranAioEndIoStatement(ptr %76)
  %79 = load i64, ptr %2, align 8, !tbaa !3
  %80 = icmp sgt i64 %79, 0
  br i1 %80, label %.lr.ph489.preheader, label %._crit_edge490

.lr.ph489.preheader:                              ; preds = %._crit_edge486
  %.unpack400.pre494 = load ptr, ptr @_QFEans.0, align 8, !tbaa !7
  %.unpack407.unpack.unpack.pre497 = load i64, ptr @_QFEans.7, align 8, !tbaa !7
  br label %.lr.ph489

.lr.ph489:                                        ; preds = %.lr.ph489.preheader, %91
  %.unpack407.unpack.unpack = phi i64 [ %.unpack407.unpack.unpack498, %91 ], [ %.unpack407.unpack.unpack.pre497, %.lr.ph489.preheader ]
  %.unpack400 = phi ptr [ %.unpack400495, %91 ], [ %.unpack400.pre494, %.lr.ph489.preheader ]
  %81 = phi i64 [ %92, %91 ], [ 1, %.lr.ph489.preheader ]
  %82 = sub i64 %81, %.unpack407.unpack.unpack
  %83 = getelementptr i64, ptr %.unpack400, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !3
  %85 = icmp eq i64 %84, 1
  br i1 %85, label %86, label %91

86:                                               ; preds = %.lr.ph489
  %87 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.2869302C317829, i64 7, ptr null, i32 -1, ptr nonnull @_QQcl.deff46d2c9823245e8b485001751cb1c, i32 31)
  %88 = call i1 @_FortranAioSetAdvance(ptr %87, ptr nonnull @_QQcl.6E6F, i64 2)
  %89 = call i1 @_FortranAioOutputInteger64(ptr %87, i64 %81)
  %90 = call i32 @_FortranAioEndIoStatement(ptr %87)
  %.unpack400.pre = load ptr, ptr @_QFEans.0, align 8, !tbaa !7
  %.unpack407.unpack.unpack.pre = load i64, ptr @_QFEans.7, align 8, !tbaa !7
  br label %91

91:                                               ; preds = %86, %.lr.ph489
  %.unpack407.unpack.unpack498 = phi i64 [ %.unpack407.unpack.unpack.pre, %86 ], [ %.unpack407.unpack.unpack, %.lr.ph489 ]
  %.unpack400495 = phi ptr [ %.unpack400.pre, %86 ], [ %.unpack400, %.lr.ph489 ]
  %92 = add nuw i64 %81, 1
  %exitcond492.not = icmp eq i64 %81, %79
  br i1 %exitcond492.not, label %._crit_edge490, label %.lr.ph489

._crit_edge490:                                   ; preds = %91, %._crit_edge486
  %93 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.284129, i64 3, ptr null, i32 -1, ptr nonnull @_QQcl.deff46d2c9823245e8b485001751cb1c, i32 33)
  %94 = call i1 @_FortranAioOutputAscii(ptr %93, ptr nonnull @_QQcl., i64 0)
  %95 = call i32 @_FortranAioEndIoStatement(ptr %93)
  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 {} @_FortranAReportFatalUserError(ptr, ptr, i32) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger64(ptr, i64) local_unnamed_addr

declare i1 @_FortranAioSetAdvance(ptr, ptr, i64) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

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

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

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) }
attributes #2 = { 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}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.unroll.disable"}
