n = int(input())
s = input()
j = 1
result = [0]
end = n//2 + 1
for i in range(n):
    while (j < n-1) and (s[i:j] in s[:i]+"0"+s[j:]):
        j += 1
    result.append(j-i-1)
print(max(result)) n = int(input()) n int(input()) int input() input s = input() s input() input j = 1 j 1 result = [0] result [0] 0 end = n//2 + 1 end n//2 + 1 n//2 n 2 1 for i in range(n):
    while (j < n-1) and (s[i:j] in s[:i]+"0"+s[j:]):
        j += 1
    result.append(j-i-1) i range(n) range n while (j < n-1) and (s[i:j] in s[:i]+"0"+s[j:]):
        j += 1
     (j < n-1) and (s[i:j] in s[:i]+"0"+s[j:]) j < n-1 j n-1 n 1 s[i:j] in s[:i]+"0"+s[j:] s[i:j] s i:j i j s[:i]+"0"+s[j:] s[:i]+"0" s[:i] s :i i "0" s[j:] s j: j j += 1 j 1 result.append(j-i-1) result.append result append j-i-1 j-i j i 1 print(max(result)) print max(result) max result end = n//2 + 1 n//2 + 1 end n = int(input()) int(input()) n result = [0] [0] result s = input() input() s j += 1 1 j j = 1 1 j
n = int(input())
s = input()
j = 1
result = [0]
end = n//2 + 1
for i in range(n):
    while (j < n-1) and (s[i:j] in s[:i]+"0"+s[j:]):
        j += 1
    result.append(j-i-1)
print(max(result))