program main
Implicit None
	integer(8)::n,i,p1=0,p2=0
	character(len=100000)::s
	
	read*,s
	n = len_trim(s)
	
	do i =1,n
		if(mod(i,2)== 0)then
			if(s(i:i) == "0")then
				p1 = p1+1
			endif
			else
			if(s(i:i) == "1")then
				p1 = p1+1
			endif
		endif
	enddo
	
	do i =1,n
		if(mod(i,2)== 0)then
			if(s(i:i) == "1")then
				p2 = p2+1
			endif
			else
			if(s(i:i) == "0")then
				p2 = p2+1
			endif
		endif
	enddo
	
	print"(i0)",min(p1,p2)
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"

@_QFEp1 = internal unnamed_addr global i64 0
@_QFEp2 = internal unnamed_addr global i64 0
@_QFEs = internal global [100000 x i8] undef
@_QQcl.143e3ae2db6cacaf9df81ccee7e10da0 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4491/source.f\00"
@_QQcl.30 = linkonce constant [1 x i8] c"0"
@_QQcl.31 = linkonce constant [1 x i8] c"1"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.143e3ae2db6cacaf9df81ccee7e10da0, i32 6)
  %2 = tail call i1 @_FortranAioInputAscii(ptr %1, ptr nonnull @_QFEs, i64 100000)
  %3 = tail call i32 @_FortranAioEndIoStatement(ptr %1)
  br label %4

4:                                                ; preds = %0, %4
  %5 = phi i64 [ 99999, %0 ], [ %9, %4 ]
  %6 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %5
  %7 = load i8, ptr %6, align 1, !tbaa !3
  %8 = icmp eq i8 %7, 32
  %9 = add nsw i64 %5, -1
  %10 = icmp ne i64 %5, 0
  %11 = and i1 %8, %10
  br i1 %11, label %4, label %12

12:                                               ; preds = %4
  %13 = shl i64 %5, 32
  %sext = add i64 %13, 4294967296
  %14 = ashr exact i64 %sext, 32
  %15 = select i1 %8, i64 0, i64 %14
  %16 = icmp sgt i64 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %30
  br i1 %16, label %.lr.ph13, label %._crit_edge

.lr.ph:                                           ; preds = %12, %30
  %17 = phi i64 [ %31, %30 ], [ 1, %12 ]
  %18 = and i64 %17, 1
  %19 = icmp eq i64 %18, 0
  %20 = add nsw i64 %17, -1
  %21 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %20
  br i1 %19, label %22, label %25

22:                                               ; preds = %.lr.ph
  %23 = tail call i32 @_FortranACharacterCompareScalar1(ptr %21, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %.sink.split, label %30

25:                                               ; preds = %.lr.ph
  %26 = tail call i32 @_FortranACharacterCompareScalar1(ptr %21, ptr nonnull @_QQcl.31, i64 1, i64 1)
  %27 = icmp eq i32 %26, 0
  br i1 %27, label %.sink.split, label %30

.sink.split:                                      ; preds = %25, %22
  %28 = load i64, ptr @_QFEp1, align 8, !tbaa !3
  %29 = add i64 %28, 1
  store i64 %29, ptr @_QFEp1, align 8, !tbaa !3
  br label %30

30:                                               ; preds = %.sink.split, %22, %25
  %31 = add nuw nsw i64 %17, 1
  %exitcond.not = icmp eq i64 %17, %15
  br i1 %exitcond.not, label %.preheader, label %.lr.ph

.lr.ph13:                                         ; preds = %.preheader, %45
  %32 = phi i64 [ %46, %45 ], [ 1, %.preheader ]
  %33 = and i64 %32, 1
  %34 = icmp eq i64 %33, 0
  %35 = add nsw i64 %32, -1
  %36 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %35
  br i1 %34, label %37, label %40

37:                                               ; preds = %.lr.ph13
  %38 = tail call i32 @_FortranACharacterCompareScalar1(ptr %36, ptr nonnull @_QQcl.31, i64 1, i64 1)
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %.sink.split18, label %45

40:                                               ; preds = %.lr.ph13
  %41 = tail call i32 @_FortranACharacterCompareScalar1(ptr %36, ptr nonnull @_QQcl.30, i64 1, i64 1)
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %.sink.split18, label %45

.sink.split18:                                    ; preds = %40, %37
  %43 = load i64, ptr @_QFEp2, align 8, !tbaa !3
  %44 = add i64 %43, 1
  store i64 %44, ptr @_QFEp2, align 8, !tbaa !3
  br label %45

45:                                               ; preds = %.sink.split18, %37, %40
  %46 = add nuw nsw i64 %32, 1
  %exitcond15.not = icmp eq i64 %32, %15
  br i1 %exitcond15.not, label %._crit_edge, label %.lr.ph13

._crit_edge:                                      ; preds = %45, %12, %.preheader
  %47 = tail call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.143e3ae2db6cacaf9df81ccee7e10da0, i32 33)
  %48 = load i64, ptr @_QFEp1, align 8, !tbaa !3
  %49 = load i64, ptr @_QFEp2, align 8, !tbaa !3
  %50 = tail call i64 @llvm.smin.i64(i64 %48, i64 %49)
  %51 = tail call i1 @_FortranAioOutputInteger64(ptr %47, i64 %50)
  %52 = tail call i32 @_FortranAioEndIoStatement(ptr %47)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

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

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i32 @_FortranACharacterCompareScalar1(ptr, ptr, i64, i64) 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.smin.i64(i64, i64) #0

attributes #0 = { 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"}
