n = int(input())
s = input()
r = reversed(s)
suf = 0
prf = 0
pow = 1
mod = 1000000007
p = 29
best = 0
this = 1
for l in r:
    a = ord(l) - ord('a')
    suf = (suf + a * pow) % mod
    prf = (prf * p + a) % mod
    pow = (pow * p) % mod
    if suf == prf:
        best = this
    this += 1
print(n - best)
