program ABC142C
    implicit none
    integer:: N,i
    integer:: result=1
    character:: S*100000

    read (5,*) N
    read (5,*) S
    
    do i=1,N-1
        if(S(i:i)/=S(i+1:i+1)) then
            result=result+1
        end if
    end do

    print '(i0)',result
end program ABC142C
; 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"

@_QFEresult = internal unnamed_addr global i32 1
@_QFEs = internal global [100000 x i8] undef
@_QQcl.54fa5aeec7e556ceebb6aac21e9937f2 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_3121/source.f\00"
@_QQcl.28693029 = linkonce constant [4 x i8] c"(i0)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

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

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

.lr.ph:                                           ; preds = %.lr.ph.preheader, %21
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %21 ]
  %12 = add nsw i64 %indvars.iv, -1
  %13 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %12
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %sext = shl i64 %indvars.iv.next, 32
  %14 = ashr exact i64 %sext, 32
  %15 = add nsw i64 %14, -1
  %16 = getelementptr [100000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %15
  %17 = call i32 @_FortranACharacterCompareScalar1(ptr %13, ptr %16, i64 1, i64 1)
  %.not = icmp eq i32 %17, 0
  br i1 %.not, label %21, label %18

18:                                               ; preds = %.lr.ph
  %19 = load i32, ptr @_QFEresult, align 4, !tbaa !3
  %20 = add i32 %19, 1
  store i32 %20, ptr @_QFEresult, align 4, !tbaa !3
  br label %21

21:                                               ; preds = %18, %.lr.ph
  %exitcond.not = icmp eq i64 %indvars.iv, %11
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %21, %0
  %22 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.28693029, i64 4, ptr null, i32 -1, ptr nonnull @_QQcl.54fa5aeec7e556ceebb6aac21e9937f2, i32 16)
  %23 = load i32, ptr @_QFEresult, align 4, !tbaa !3
  %24 = call i1 @_FortranAioOutputInteger32(ptr %22, i32 %23)
  %25 = call i32 @_FortranAioEndIoStatement(ptr %22)
  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 @_FortranAioInputAscii(ptr, ptr, i64) 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 @_FortranAioOutputInteger32(ptr, i32) 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"}
