program main
    implicit none
    character(100) S
	integer N, i, j, k, l, ans, counter
	read(*, *) N
	read(*, *) S
	ans = 0
	do i = 1, N-1
	counter = 0
	    do j = 1, i
			do l = 1, j-1
				if (S(j: j) == S(l: l)) then
					goto 1
				end if
			end do
			do k = i+1, N
				if (S(j: j) == S(k: k)) then
					counter = counter + 1
					exit
				end if
			end do
1 continue
		end do
		ans = max(ans,counter)
	end do
	write(*, *) ans
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"

@_QFEs = internal global [100 x i8] undef
@_QQcl.163de81ce4f45cad4571053086237f83 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5936/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca i32, align 4
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.163de81ce4f45cad4571053086237f83, i32 5)
  %3 = call i1 @_FortranAioInputInteger(ptr %2, ptr nonnull %1, i32 4)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.163de81ce4f45cad4571053086237f83, i32 6)
  %6 = call i1 @_FortranAioInputAscii(ptr %5, ptr nonnull @_QFEs, i64 100)
  %7 = call i32 @_FortranAioEndIoStatement(ptr %5)
  %8 = load i32, ptr %1, align 4, !tbaa !3
  %.02846 = add i32 %8, -1
  %9 = icmp sgt i32 %.02846, 0
  br i1 %9, label %.preheader33, label %._crit_edge50

.preheader33:                                     ; preds = %0, %._crit_edge45
  %indvars.iv55 = phi i32 [ %indvars.iv.next56, %._crit_edge45 ], [ 2, %0 ]
  %.02548 = phi i32 [ %37, %._crit_edge45 ], [ 1, %0 ]
  %.02747 = phi i32 [ %36, %._crit_edge45 ], [ 0, %0 ]
  %10 = icmp sgt i32 %.02548, 0
  br i1 %10, label %.preheader, label %._crit_edge45

.preheader:                                       ; preds = %.preheader33, %.loopexit
  %.02443 = phi i32 [ %35, %.loopexit ], [ 1, %.preheader33 ]
  %.02642 = phi i32 [ %.1, %.loopexit ], [ 0, %.preheader33 ]
  %.not = icmp eq i32 %.02443, 1
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %11 = sext i32 %.02443 to i64
  %12 = add nsw i64 %11, -1
  %13 = getelementptr [100 x [1 x i8]], ptr @_QFEs, i64 0, i64 %12
  %wide.trip.count = zext i32 %.02443 to i64
  br label %15

14:                                               ; preds = %15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %15

15:                                               ; preds = %.lr.ph, %14
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %14 ]
  %16 = add nsw i64 %indvars.iv, -1
  %17 = getelementptr [100 x [1 x i8]], ptr @_QFEs, i64 0, i64 %16
  %18 = call i32 @_FortranACharacterCompareScalar1(ptr %13, ptr %17, i64 1, i64 1)
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %.loopexit, label %14

._crit_edge:                                      ; preds = %14, %.preheader
  %20 = load i32, ptr %1, align 4, !tbaa !3
  %21 = sub i32 %20, %.02548
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph40, label %.loopexit

.lr.ph40:                                         ; preds = %._crit_edge
  %23 = sext i32 %.02443 to i64
  %24 = add nsw i64 %23, -1
  %25 = getelementptr [100 x [1 x i8]], ptr @_QFEs, i64 0, i64 %24
  br label %26

26:                                               ; preds = %.lr.ph40, %34
  %.02338.in = phi i32 [ %.02548, %.lr.ph40 ], [ %.02338, %34 ]
  %.02338 = add nuw i32 %.02338.in, 1
  %27 = sext i32 %.02338 to i64
  %28 = add nsw i64 %27, -1
  %29 = getelementptr [100 x [1 x i8]], ptr @_QFEs, i64 0, i64 %28
  %30 = call i32 @_FortranACharacterCompareScalar1(ptr %25, ptr %29, i64 1, i64 1)
  %31 = icmp eq i32 %30, 0
  br i1 %31, label %32, label %34

32:                                               ; preds = %26
  %33 = add i32 %.02642, 1
  br label %.loopexit

34:                                               ; preds = %26
  %exitcond54.not = icmp eq i32 %.02338, %20
  br i1 %exitcond54.not, label %.loopexit, label %26

.loopexit:                                        ; preds = %15, %34, %._crit_edge, %32
  %.1 = phi i32 [ %33, %32 ], [ %.02642, %._crit_edge ], [ %.02642, %34 ], [ %.02642, %15 ]
  %35 = add nuw i32 %.02443, 1
  %exitcond57.not = icmp eq i32 %35, %indvars.iv55
  br i1 %exitcond57.not, label %._crit_edge45, label %.preheader

._crit_edge45:                                    ; preds = %.loopexit, %.preheader33
  %.026.lcssa = phi i32 [ 0, %.preheader33 ], [ %.1, %.loopexit ]
  %36 = call i32 @llvm.smax.i32(i32 %.02747, i32 %.026.lcssa)
  %37 = add nuw i32 %.02548, 1
  %indvars.iv.next56 = add nuw i32 %indvars.iv55, 1
  %exitcond58.not = icmp eq i32 %indvars.iv55, %8
  br i1 %exitcond58.not, label %._crit_edge50, label %.preheader33

._crit_edge50:                                    ; preds = %._crit_edge45, %0
  %.027.lcssa = phi i32 [ 0, %0 ], [ %36, %._crit_edge45 ]
  %38 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.163de81ce4f45cad4571053086237f83, i32 26)
  %39 = call i1 @_FortranAioOutputInteger32(ptr %38, i32 %.027.lcssa)
  %40 = call i32 @_FortranAioEndIoStatement(ptr %38)
  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 @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #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"}
