N=int(input())
S=input()

long=0
for i in range(N-1):
  for j in range(i+long+1,N):
    if not (S[i:j] in S[j:]):
      break
  long=max(long,j-i-1)
print(long) N=int(input()) N int(input()) int input() input S=input() S input() input long=0 long 0 for i in range(N-1):
  for j in range(i+long+1,N):
    if not (S[i:j] in S[j:]):
      break
  long=max(long,j-i-1) i range(N-1) range N-1 N 1 for j in range(i+long+1,N):
    if not (S[i:j] in S[j:]):
      break
   j range(i+long+1,N) range i+long+1 i+long i long 1 N if not (S[i:j] in S[j:]):
      break
   not (S[i:j] in S[j:]) S[i:j] in S[j:] S[i:j] S i:j i j S[j:] S j: j break long=max(long,j-i-1) long max(long,j-i-1) max long j-i-1 j-i j i 1 print(long) print long N=int(input()) int(input()) N long=max(long,j-i-1) max(long,j-i-1) long long=0 0 long S=input() input() S
N=int(input())
S=input()

long=0
for i in range(N-1):
  for j in range(i+long+1,N):
    if not (S[i:j] in S[j:]):
      break
  long=max(long,j-i-1)
print(long)