N = int(input())
S = input()
ok, ng = 0, N + 1
while abs(ok - ng) > 1:
    x = (ok + ng) // 2
    check = set()
    for i in range(N - x + 1):
        check.add(S[i: i + x])
        if S[i + x: i + 2 * x] in check:
            ok = x
            break
    else:
        ng = x

print(ok) N = int(input()) N int(input()) int input() input S = input() S input() input ok, ng = 0, N + 1 ok 0 ng N + 1 N 1 while abs(ok - ng) > 1:
    x = (ok + ng) // 2
    check = set()
    for i in range(N - x + 1):
        check.add(S[i: i + x])
        if S[i + x: i + 2 * x] in check:
            ok = x
            break
    else:
        ng = x abs(ok - ng) > 1 abs(ok - ng) abs ok - ng ok ng 1 x = (ok + ng) // 2 x (ok + ng) // 2 ok + ng ok ng 2 check = set() check set() set for i in range(N - x + 1):
        check.add(S[i: i + x])
        if S[i + x: i + 2 * x] in check:
            ok = x
            break
    else:
        ng = x i range(N - x + 1) range N - x + 1 N - x N x 1 check.add(S[i: i + x]) check.add check add S[i: i + x] S i: i + x i i + x i x if S[i + x: i + 2 * x] in check:
            ok = x
            break
     S[i + x: i + 2 * x] in check S[i + x: i + 2 * x] S i + x: i + 2 * x i + x i x i + 2 * x i 2 * x 2 x check ok = x ok x break ng = x ng x print(ok) print ok x = (ok + ng) // 2 (ok + ng) // 2 x S = input() input() S ng = 0, N + 1 N + 1 ng ng = x x ng ok = x x ok ok, ng = 0, N + 1 0 ok check = set() set() check N = int(input()) int(input()) N
N = int(input())
S = input()
ok, ng = 0, N + 1
while abs(ok - ng) > 1:
    x = (ok + ng) // 2
    check = set()
    for i in range(N - x + 1):
        check.add(S[i: i + x])
        if S[i + x: i + 2 * x] in check:
            ok = x
            break
    else:
        ng = x

print(ok)