n = int(input())
s = input()
ret = 0
for l in range(n):
  while s[l:l+ret+1] in s[l+ret+1:]:
    ret += 1
print(ret) n = int(input()) n int(input()) int input() input s = input() s input() input ret = 0 ret 0 for l in range(n):
  while s[l:l+ret+1] in s[l+ret+1:]:
    ret += 1 l range(n) range n while s[l:l+ret+1] in s[l+ret+1:]:
    ret += 1 s[l:l+ret+1] in s[l+ret+1:] s[l:l+ret+1] s l:l+ret+1 l l+ret+1 l+ret l ret 1 s[l+ret+1:] s l+ret+1: l+ret+1 l+ret l ret 1 ret += 1 ret 1 print(ret) print ret ret = 0 0 ret ret += 1 1 ret n = int(input()) int(input()) n s = input() input() s
n = int(input())
s = input()
ret = 0
for l in range(n):
  while s[l:l+ret+1] in s[l+ret+1:]:
    ret += 1
print(ret)