You are given a string s consisting of n lowercase Latin letters. You have to type this string using your keyboard.

Initially, you have an empty string. Until you type the whole string, you may perform the following operation:  add a character to the end of the string. 

Besides, at most once you may perform one additional operation: copy the string and append it to itself.

For example, if you have to type string abcabca, you can type it in 7 operations if you type all the characters one by one. However, you can type it in 5 operations if you type the string abc first and then copy it and type the last character.

If you have to type string aaaaaaaaa, the best option is to type 4 characters one by one, then copy the string, and then type the remaining character.

Print the minimum number of operations you need to type the given string.


-----Input-----

The first line of the input containing only one integer number n (1 ≤ n ≤ 100) — the length of the string you have to type. The second line containing the string s consisting of n lowercase Latin letters.


-----Output-----

Print one integer number — the minimum number of operations you need to type the given string.


-----Examples-----
Input
7
abcabca

Output
5

Input
8
abcdefgh

Output
8



-----Note-----

The first test described in the problem statement.

In the second test you can only type all the characters one by one.

Source: codeforces | Difficulty: MEDIUM
Tags: String algorithms

Implementation


Solutions:
n = int(input())
s = input()
ans = 0
for i in range(1, n):
	a = s[:i]
	b = s[i:]
	if len(a) > len(b):
		break
	if b[:len(a)] == a:
		ans = i
if ans == 0:
	print(n)
else:
	f_ans = ans + 1 + (n - 2 * ans)
	print(f_ans)


n = int(input())
s = input()
res = n
for i in range(1, n):
	if s.startswith(s[:i] * 2):
		res = n - i + 1
print(res)


n = int(input())
s = input()
i = n - 1 - n % 2
while s[:i // 2 + 1] != s[i // 2 + 1:i + 1]:
	i -= 2
i = max(0, i)
print(n - i // 2)


numOfChar = int(input())
stringOfMov = input()
endpoint = int(numOfChar / 2)
maxlength = 0
if numOfChar > 1:
	while endpoint > 1:
		if stringOfMov[0:endpoint] == stringOfMov[endpoint:endpoint * 2]:
			maxlength = endpoint
			endpoint = 0
		else:
			endpoint -= 1
			maxlength = endpoint
	if numOfChar == 2:
		print(2)
	elif numOfChar == 3:
		print(3)
	else:
		print(numOfChar - maxlength + 1)
else:
	print(1)


n = int(input())
string = input()

def min(a, b):
	return a if a < b else b
cur = ''
ans = n
for i in range(len(string)):
	if string.startswith(cur + cur):
		ans = min(ans, n - i + 1)
	cur += string[i]
print(ans)


n = int(input())
s = input()
ans = n
for i in range(1, n // 2 + 1):
	if s[:i] == s[i:i * 2]:
		ans = n - i + 1
print(ans)


n = int(input())
s = input()
size = 0
i = n - 1
while i > -1:
	if i % 2 == 0:
		size += 1
		i -= 1
	elif s[:(i + 1) // 2] == s[(i + 1) // 2:i + 1]:
		size += (i + 1) // 2 + 1
		break
	else:
		size += 2
		i -= 2
print(size)


n = int(input())
s = input()
ans = n
for i in range(0, n // 2 + 1):
	b = 1
	for j in range(0, i):
		if s[j] != s[i + j]:
			b = 0
	if b:
		ans = min(ans, n - i + 1)
print(ans)


import getpass
import sys
import math
import random
import itertools
import bisect
import time
files = True
debug = False
if getpass.getuser() == 'frohenk' and files:
	debug = True
	sys.stdin = open('test.in')
elif files:
	pass

def lcm(a, b):
	return a * b // math.gcd(a, b)

def ria():
	return [int(i) for i in input().split()]

def range_sum(a, b):
	ass = (b - a + 1) // 2 * (a + b)
	if (a - b) % 2 == 0:
		ass += (b - a + 2) // 2
	return ass

def comba(n, x):
	return math.factorial(n) // math.factorial(n - x) // math.factorial(x)
n = ria()[0]
suma = n
st = input()
mx = 0
for i in range(1, n + 1):
	if i + i <= n:
		if st[:i] == st[i:i + i]:
			mx = max(mx, len(st[:i]) - 1)
print(n - mx)


n = int(input())
s = input()
index = 0
for i in range(n):
	for j in range(n - i + 1):
		s1 = s[:i]
		s2 = s[i:i + j]
		if s1 == s2:
			index = i
op = index + 1
op += n - 2 * index
if index == 0:
	op -= 1
print(op)


n = int(input())
s = input()
max_p = 0
for i in range(1, (len(s) + 1) // 2 + 1):
	a = s[:i]
	b = s[i:i + i]
	if a == b:
		max_p = i
print(min(max_p + (len(s) - 2 * max_p) + 1, n))


def determine_steps(string: str):
	len_string = len(string)
	max_copy_len = 0
	for i in range(1, len_string):
		if i * 2 <= len_string and string[:i] == string[i:i * 2]:
			max_copy_len = i
	if max_copy_len == 0:
		return len_string
	else:
		return 1 + max_copy_len + (len_string - max_copy_len * 2)
x = input()
string = input()
print(determine_steps(string))


import sys
n = int(input())
s = input()
ans = 0
for i in range(1, n):
	if s[:i] == s[i:i + i]:
		ans = max(ans, i - 1)
print(n - ans)


(n, s) = (int(input()), input())
for L in range(len(s) // 2, 1, -1):
	if s[:L] == s[L:2 * L]:
		print(n - L + 1)
		break
else:
	print(n)


n = int(input())
s = input()
k = 0
for i in reversed(range(1, int((n + 2) / 2))):
	if s[0:i] == s[i:2 * i]:
		k = i
		break
print(min(n - k + 1, n))


n = int(input())
seq = input()
count = n
for i in range(1, n // 2 + 1):
	if seq[0:i] == seq[i:min(2 * i, n)]:
		count = n + 1 - i
print(count)


n = int(input().split()[0])
st = str(input())
m = 1
for i in range(2, 1 + n // 2):
	if st[:i] == st[i:2 * i]:
		m = i
print(n - m + 1)


n = int(input())
s = input()
mx = 0
i = 0
for j in range(i + 1, n):
	if s[i:j] == s[j:(j + (j - i)) % (n + 1)]:
		mx = max(mx, j - i)
if mx == 0:
	print(n)
else:
	print(n - mx + 1)


n = input()
s = input()
best = 0
for i in range(len(s) // 2 + 1):
	t = s[:i] * 2
	try:
		if s.index(t) == 0:
			best = i
	except:
		pass
if best > 0:
	print(len(s) - best + 1)
else:
	print(len(s))


n = int(input())
s = input().strip()
m = 0
for i in range(1, n):
	if s[:i] == s[i:2 * i]:
		m = i
if m == 0:
	m = 1
print(n - m + 1)


n = int(input())
s = input()
i = 1
curr = s[0]
match = ''
while i < n:
	if s[i:2 * i] == curr:
		match = curr
		curr += s[i]
		i += 1
	else:
		curr += s[i]
		i += 1
if len(match) != 0:
	print(n - len(match) + 1)
else:
	print(n)


n = int(input())
word = input()
tempPatt = ''
count = 1
while count < n:
	pattern = word[0:count]
	pos = word.find(pattern)
	pos2 = word.find(pattern, pos + len(pattern))
	if pos2 == pos + len(pattern):
		tempPatt = pattern
	count += 1
if tempPatt != '':
	print(len(word) - len(tempPatt) + 1)
else:
	print(n)


n = int(input())
s = input()
longest = 0
for i in range(1, n + 1):
	if s[0:i] == s[i:2 * i]:
		longest = i
if longest:
	print(n - longest + 1)
else:
	print(n)


import math
n = int(input())
string = input()
best = n
for i in range(1, n // 2 + 1):
	if string[0:i] == string[i:2 * i]:
		best = n - i + 1
print(best)


def get_amount_step(str):
	for i in range(len(str) // 2, 1, -1):
		if str[0:i] == str[i:2 * i]:
			return i + 1 + len(str) - 2 * i
	return len(str)
n = int(input())
row = input()[:n]
print(get_amount_step(row))


length = input()
text = input()
len_dec = 0
conseq_str = str()
match_length = 0
match_found = False
try:
	idx = 0
	length = 1
	while idx < len(text):
		conseq_str = text[:idx + 1]
		poss_match = text[idx + 1:idx + length + 1]
		if conseq_str == poss_match:
			match_length = length
			match_found = True
		length += 1
		idx += 1
	if match_found:
		total_moves = match_length + 1 + (len(text) - 2 * match_length)
	else:
		total_moves = len(text)
	print(total_moves)
except:
	print(0)


n = int(input())
A = input()
best_result = n
for i in range(1, n // 2 + 1):
	if A[0:i] == A[i:2 * i]:
		best_result = i + 1 + n - 2 * i
print(best_result)


def main():
	flag = 13
	n = int(input())
	s = input()
	tmp = n
	while tmp > 1:
		test = tmp // 2
		a = s[:test]
		b = s[test:]
		if b.startswith(a):
			ans = n - 2 * test + test + 1
			print(ans)
			return 0
		tmp -= 1
	print(n)
main()


n = int(input())
st = input()
data = []
if n > 3:
	for i in range(2, n):
		t = 2
		while i * t <= n and st[0:i] == st[i:i * t]:
			t += 1
		data.append((t - 2, i))
	mx1 = max(data, key=lambda x: (x[0], x[1]))[1]
	mx2 = max(data, key=lambda x: (x[0], x[1]))[0]
	print(mx1 + mx2 + (n - mx1 * mx2 - mx1))
else:
	print(n)


n = int(input())
s = input()
pr = ''
for k in range(n // 2, -1, -1):
	if s[:k] == s[k:2 * k]:
		break
print(min(n - k + 1, n))


n = int(input())
s = input()
max_copy_len = -1
for i in range(1, n // 2 + 1):
	if s[:i] == s[i:2 * i]:
		max_copy_len = i
if max_copy_len == -1:
	print(n)
else:
	print(n - max_copy_len + 1)


n = int(input())
s = str(input())
ans = len(s)
for i in range(1, n + 1):
	if s[:i] + s[:i] == s[:2 * i] and 2 * i <= n:
		ans = min(ans, n - i + 1)
print(ans)


n = int(input())
s = input()
ans = n
for i in range(n):
	ss = s[:i]
	if 2 * i <= n and s[:i] == s[i:2 * i]:
		ans = min(ans, n - i + 1)
print(ans)


input()
s = input()
ans = len(s)
for i in range(len(s) // 2, 0, -1):
	if s[:i] == s[i:2 * i]:
		ans = len(s) - i + 1
		break
print(ans)


n = int(input())
s = [k for k in input()]
m = 1
for i in range(1, n):
	if s[:i] == s[i:2 * i]:
		m = i
print(n + 1 - m)


am = int(input())
arr = list(input())
ind = am - (am & 1)
while True:
	if arr[:ind][int(ind / 2):] == arr[:ind][:int(ind / 2)]:
		if ind:
			print(1 + ind // 2 + am - ind)
		else:
			print(am)
		break
	else:
		ind -= 2


def main():
	n = map(int, input().split())
	string = input()
	(idx, result, consumed) = (len(string), 0, False)
	while idx > 0:
		if idx % 2 == 0 and string[:idx // 2] == string[idx // 2:idx] and (not consumed):
			idx //= 2
			consumed = True
		else:
			idx -= 1
		result += 1
	print(result)
main()


def thisLetter(n, perfectString, currentString, copyingDone, bestNum, operationsDone):
	if len(currentString) < n:
		if not copyingDone and len(perfectString) >= len(currentString) and (currentString != ''):
			bestNum = thisLetter(n, perfectString, currentString + currentString, True, bestNum, operationsDone + 1)
		bestNum = thisLetter(n, perfectString, currentString + perfectString[len(currentString)], copyingDone, bestNum, operationsDone + 1)
	elif perfectString == currentString:
		bestNum = min(operationsDone, bestNum)
	return bestNum
n = int(input())
s = str(input())
print(thisLetter(n, s, '', False, n, 0))


n = int(input())
s = input()
ans = n
for l in range(1, n // 2 + 1):
	if s[:l] == s[l:2 * l]:
		ans = min(ans, n - l + 1)
print(ans)


n = int(input())
s = input()
i = 0
for x in range(1, n // 2 + 1):
	if s[:x] == s[x:2 * x]:
		i = x
if i == 0:
	i = 1
print(1 + n - i)


L = int(input())
s = input()
for i in range(L // 2, 2 - 1, -1):
	if s[i:].startswith(s[:i]):
		print(L - i + 1)
		break
else:
	print(L)


import sys, math
n = int(input())
s = input()
ans = 0
i = n - 1
flag = True
while i >= 0:
	if i % 2 == 1 and s[:i // 2 + 1] == s[i // 2 + 1:i + 1] and flag:
		ans += 1
		i //= 2
		flag = False
	else:
		i -= 1
		ans += 1
print(ans)


n = int(input())
c = input()
ans = ''
res = n
for i in range(n // 2):
	ans += c[i]
	if ans * 2 == c[:2 * len(ans)]:
		res = -len(ans) + 1 + n
print(res)


n = int(input())
s = input()
d = ''
Max = len(s)
count = Max
for i in range(len(s)):
	d = d + s[i]
	if s[i + 1:].find(d) == 0:
		count = len(s) - len(d) + 1
	if count < Max:
		Max = count
print(count)


(n, a, j, i) = (int(input()), input(), 0, 1)
while i < n // 2 + 1:
	if a[:i] == a[i:2 * i]:
		if j < i:
			j = i
	i += 1
print([n, n + 1 - j][j > 0])


n = int(input())
a = input()
x = 0
for i in range(n // 2, 1, -1):
	if a[0:i] == a[i:i + i]:
		x = i - 1
		break
print(n - x)


(n, t) = (int(input()), input())
max_copy_len = 0
for i in range(2, n):
	if t[:i] == t[i:i * 2]:
		max_copy_len = i
ans = len(t)
ans -= max_copy_len - 1 if max_copy_len else 0
print(ans)


n = int(input())
s = input()
word = ''
biggest_repetition = 1
for i in range(len(s)):
	word += s[i]
	if word in s[i + 1:i + len(word) + 1]:
		biggest_repetition = max(biggest_repetition, len(word))
print(len(s) - biggest_repetition + 1)


r = input
ans = n = int(r())
s = r()
len = 1
while len * 2 <= n:
	if s[0:len] == s[len:len * 2]:
		ans = min(ans, n - len + 1)
	len += 1
print(ans)


n = int(input())
k = n
s = input()
rez = 0
while n > 0:
	if n & 1:
		n -= 1
		pass
	elif s[:n // 2] == s[n // 2:n]:
		rez = n // 2 + 1
		break
	else:
		n -= 2
print(k - n + rez)


n = int(input())
st = input()
if n % 2 == 0:
	k = 0
else:
	k = 1
div = int(n / 2)
i = div
while i >= 0:
	k = n - 2 * i
	st1 = st[:i]
	st2 = st[i:2 * i]
	if st1 == st2:
		k = k + i + 1
		break
	i = i - 1
if k > n:
	k = n
print(k)


n = int(input())
a = input()
mx = 0
for i in range(len(a) - 1):
	if a[i:].startswith(a[:i]):
		mx = i
if mx > 0:
	mx -= 1
print(len(a) - mx)


n = int(input())
s = input().strip()
res = n
for i in range(n):
	if i % 2 > 0:
		l = i + 1
		h = l // 2
		a = s[:h]
		b = s[h:l]
		if a == b:
			res = min(res, h + 1 + (n - 2 * h))
print(res)


n = int(input())
s = input()
count = n
a = 0
for i in range(n):
	for j in range(i + 1, n + 1):
		if s[0:i] == s[i:j]:
			a = i
if a != 0:
	count += 1
print(count - a)


import sys
import math
import bisect

def solve(s):
	n = len(s)
	min_val = n
	for i in range(1, n):
		if i * 2 <= n:
			if s[0:i] == s[i:2 * i]:
				val = i + 1 + (n - 2 * i)
				min_val = min(min_val, val)
	return min_val

def main():
	n = int(input())
	s = input()
	print(solve(s))
main()


n = int(input())
s = input()
res = 0
while len(s) != 0:
	if len(s) % 2 == 0:
		if s[:len(s) // 2] == s[len(s) // 2:]:
			res = res + 1 + len(s) // 2
			break
		else:
			res += 2
			s = s[:-2]
	else:
		res += 1
		s = s[:-1]
print(res)


b = input()
s = input()
n = len(s)
c = len(s)
isMade = 0
while c > 0:
	if c % 2 == 1 and isMade == 0:
		if s[:c // 2 + 1] == s[c // 2 + 1:c + 1]:
			n -= c // 2
			c = c // 2 + 1
			isMade = 1
	c -= 1
print(n)


n = int(input())
s = input()
ans = 1
for i in range(n - 1):
	for j in range(i, n):
		step = j - i + 1
		if step > n - j - 1:
			continue
		if s[i:j + 1] in s[j + 1:j + step + 1] and i == 0:
			if ans < step:
				ans = step
print(n - ans + 1)


while True:
	try:
		n = int(input())
		s = input()
		(res, cunt, i) = (n, 0, 1)
		while i <= int(n / 2):
			(j, k) = (0, i)
			while j < i:
				if s[j] != s[k]:
					break
				if j == i - 1:
					cunt = i + 1
					cunt += n - 2 * i
					res = min(res, cunt)
				j += 1
				k += 1
			i += 1
		print(res)
	except EOFError:
		break


n = int(input())
s = input()
for i in range(n // 2, -1, -1):
	if s[:i] == s[i:2 * i]:
		print(min(n, n - i + 1))
		exit()


n = int(input())
s = input()
mid = n // 2
while s[:mid] != s[mid:2 * mid] and mid != 0:
	mid -= 1
print(min(n, n - mid + 1))


n = int(input())
s = input()
m = n // 2
bestm = max([i for i in range(m + 1) if s[:i] == s[i:2 * i]])
print(min(n, n - bestm + 1))


n = int(input())
s = input()
anw = n

def calc(pos):
	x = s[:pos] + s[:pos]
	if x == s[:pos * 2]:
		return 1 + n - pos
	return 1000000000.0
for i in range(n):
	anw = min(anw, calc(i))
print(anw)


(n, s) = (int(input()), input())
e = 0
for i in range(1, n // 2 + 1):
	if s[:i] == s[i:i * 2]:
		e = i
print(n - max(e - 1, 0))


n = int(input())
s = list(input())
substr = [s[0]]
length = n
for i in range(1, n):
	if s[:i] == s[i:2 * i]:
		length = min(length, n - i + 1)
print(length)


n = int(input())
s = input()
res = 0
for (i, x) in enumerate(s):
	i += 1
	if i * 2 > n:
		break
	if s[:i] == s[i:i * 2]:
		res = i
print(min(n, n - res + 1))


n = int(input())
s = input()
indcopy = 0
for i in range(1, n // 2 + 1):
	if s[:i] == s[i:i * 2]:
		indcopy = i
print(min(n, n - indcopy + 1))


n = int(input().strip())
s = list(input().strip())
count = 0
dup = False
while n > 0:
	if dup:
		count += n
		break
	elif n % 2 == 1:
		count += 1
		n -= 1
	else:
		i = n // 2
		first = s[:i]
		second = s[i:n]
		copy = True
		for j in range(i):
			if first[j] != second[j]:
				copy = False
				n -= 2
				count += 2
				break
		if copy:
			dup = True
			count += 1
			n //= 2
print(count)


def check(sstring):
	for i in range(len(sstring) // 2):
		if sstring[i] != sstring[len(sstring) // 2 + i]:
			return False
	return True

def main():
	n = int(input())
	string = str(input())
	mx = -1
	for i in range(1, len(string), 2):
		t = string[:i + 1]
		if check(t):
			mx = max(mx, i // 2)
	if mx == -1:
		print(len(string))
	else:
		print(len(string) - mx)
main()


import math as m
l = int(input())
s = input()
i = m.trunc(l / 2) + 1
t = 0
while i > 0:
	if s[0:i] == s[i:2 * i]:
		t = i - 1
		break
	i -= 1
print(l - t)


n = int(input())
ans = 0
u = n * [0]
s = input()
for t in range(n):
	if t % 2 == 1:
		if s[:int((t + 1) / 2)] == s[int((t + 1) / 2):t + 1]:
			ans = t
print(int((ans + 1) / 2) + 1 + n - ans - 1)


n = int(input())
s = input()
c = 0
for i in range(int(n / 2), 0, -1):
	if s[0:i] == s[i:2 * i]:
		print(n - i + 1)
		c = 1
		break
if c == 0:
	print(n)


def solve(i, d):
	if len(word) == i:
		return 0
	a = 10 ** 9
	if d == 1 and i * 2 <= len(word) and (word[:i] == word[i:i * 2]):
		a = solve(i * 2, 0)
	return 1 + min(a, solve(i + 1, d))
input()
word = input()
print(1 + solve(1, 1))


n = int(input())
s = input()
for l in range(n // 2, -1, -1):
	if s[:l] == s[l:2 * l]:
		print(n - max(0, l - 1))
		break


n = int(input())
st = input()
c = 0
x = 0
ok = 0
for i in range(1, n // 2 + 1):
	if st[:i] == st[i:2 * i]:
		x = i
print(min([n, n - x + 1]))


import re
n = int(input())
s = input()
t = re.sub('^(.+)\\1.*', '\\1', s)
if len(t) == len(s):
	print(len(s))
else:
	print(len(s) - len(t) + 1)


def doshit(st, steps, ct):
	global n
	global s
	if st == s:
		return steps
	if len(st) > n // 2:
		return steps + (n - len(st))
	else:
		x = 1 << 63
		if st == s[len(st):2 * len(st)] and ct == 0:
			t = 2 * st
			x = min(doshit(t, steps + 1, 1), x)
		t1 = st + s[len(st)]
		x = min(x, doshit(t1, steps + 1, ct))
		return x
n = int(input())
s = input()
print(doshit(s[0], 1, 0))


n = int(input())
st = input()
ans = 0
mid = n // 2
while mid > 0:
	if st[:mid] == st[mid:mid * 2]:
		ans = mid + 1
		break
	else:
		mid -= 1
ans += n - mid * 2
print(ans)


s = ''
n = 0

def ok(l, r):
	global s
	global n
	if r - l % 2 == 0:
		return False
	lel = s[l:r + 1]
	return lel[:len(lel) // 2] == lel[len(lel) // 2:]

def main():
	global n
	n = int(input())
	global s
	s = input()
	ans = 0
	cur = n - 1
	while cur >= 0:
		if ok(0, cur):
			ans += cur // 2 + 1
			cur = 0
		ans += 1
		cur -= 1
	print(ans)
main()


n = int(input())
s = input()
c = 0
for i in range(1, 1 + len(s) // 2):
	if s[:i] == s[i:2 * i]:
		c = i
if c != 0:
	print(n - c + 1)
else:
	print(n)


n = int(input())
s = input()
i = n - 1
moves = 0
while i >= 0:
	c = 1
	if n - i >= i and i > 0:
		for j in range(i):
			if s[j] != s[i + j]:
				c = 0
	else:
		c = 0
	if c == 0:
		moves += 1
		i -= 1
	else:
		moves += 1
		i -= i
print(moves)


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
from itertools import permutations
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	elif n <= 2:
		return True
	else:
		for i in range(2, int(n ** 0.5) + 1):
			if n % i == 0:
				return False
		return True

def main():
	n = ii()
	s = I().strip()
	cnt = n
	maxi = 0
	for i in range(2, n // 2 + 1):
		if s[:i] == s[i:2 * i]:
			maxi = i
	if maxi != 0:
		cnt = n - maxi * 2 + maxi + 1
	print(cnt)
main()


x = int(input())
y = input()

def operations(x):
	if x == 0:
		return 0
	if x % 2 == 0:
		part = int(x / 2)
		if y[0:part] == y[part:2 * part]:
			return part + 1
		else:
			return 1 + operations(x - 1)
	else:
		return 1 + operations(x - 1)
print(operations(x))


def string_count(string='name', idx=0, num=100, end=100):
	flag = True
	for i in range(idx, end + 1):
		if i + num >= len(string):
			flag = False
			break
		if string[i] == string[i + num]:
			flag = True
		else:
			flag = False
			break
	return flag
x = int(input())
s = str(input())
max = 0
z = 1
u = 0
while 1:
	v = s.find(s[0], z)
	if v < 0:
		break
	tmp = v - u
	r = string_count(s, 1, tmp, v - 1)
	if tmp > max and r == True:
		max = tmp
	z = v + 1
if max > 0:
	max -= 1
print(x - max)


import re
import sys

def main(args):
	n = int(input())
	s = input()
	ar = []
	for i in range(n):
		t = s[:i] + s[:i] + ('' if 2 * i >= n else s[2 * i:])
		r = i + max(n - 2 * i, 0) + (i > 0)
		ar.append((t, r))
	print(min((v[1] for v in ar if v[0] == s)))
sys.exit(main(sys.argv))


n = int(input())
string = input()
maxstr = ''
for i in range(1, len(string)):
	substr = string[:i]
	remstr = string[i:]
	if len(substr) > len(remstr):
		break
	same = 1
	for i in range(len(substr)):
		if substr[i] != remstr[i]:
			same = 0
			break
	if not same:
		continue
	maxstr = substr
if maxstr != '':
	print(n - len(maxstr) + 1)
	quit()
print(len(string))


import sys, math, queue, bisect
MOD = 998244353
sys.setrecursionlimit(1000000)
n = int(input())
s = input()
ans = n
for i in range(n):
	if i & 1 == 1:
		p = (i + 2) // 2
		if s[:p] == s[p:i + 1]:
			ans = min(ans, p + n - i)
print(ans)


def run():
	n = int(input())
	string = input()
	i = 0
	half = len(string) // 2
	while half > 0:
		if string[:half] == string[half:min(len(string), half + half)]:
			return len(string) - half + 1
		half -= 1
	return len(string)
print(run())


n = int(input())
s = list(input())
max_repeat = 0
for i in range(1, n // 2 + 1):
	left = s[:i]
	right = s[i:i + i]
	if left == right:
		max_repeat = i
if max_repeat != 0:
	print(1 + n - max_repeat)
else:
	print(n)


n = int(input())

def check(s, m):
	return s[:m // 2] == s[m // 2:]
s = input()
t = 0
for i in range(n, 0, -1):
	if i % 2 == 0 and check(s[:i], i):
		t = 1
		print(i // 2 + n - i + 1)
		break
if t == 0:
	print(n)


n = int(input())
s = input()
operations = n
for i in reversed(range(1, n // 2 + 1)):
	if s[:i] == s[i:2 * i]:
		operations = n - i + 1
		break
print(operations)


n = int(input())
str = input()
max1 = 0
for i in range(1, int(n / 2) + 1):
	if str[:i] == str[i:i + i]:
		max1 = max(max1, i)
if max1 > 0:
	max1 = max1 - 1
print(n - max1)


n = int(input())
s = input()
ans = len(s)
for i in range(n):
	a = s[0:i + 1]
	if s.startswith(a + a):
		ans = len(a) + 1 + len(s) - 2 * len(a)
print(ans)


size = int(input())
string = input()
maxCycleSize = 1
i = 0
while i < len(string) // 2 + 1:
	if string[0:i] == string[i:2 * i]:
		maxCycleSize = i if i > 0 else 1
	i += 1
print(size - maxCycleSize + 1)


n = int(input())
s = input()
ans = n
for p in range(1, n):
	if 2 * p > n:
		break
	if s[:p] + s[:p] == s[:2 * p]:
		ans = min(ans, p + 1 + n - 2 * p)
print(ans)


import os
import sys
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
n = Int()
s = input()
ans = 0
ok = True
while len(s):
	ans += 1
	if len(s) % 2:
		s = s[:-1]
	else:
		k = len(s) // 2
		if s[:k] == s[k:] and ok:
			s = s[:k]
			ok = False
		else:
			s = s[:-1]
print(ans)


def find_similarities(string):
	flag = 0
	for i in range(len(string)):
		for j in range(i + 1, len(string)):
			if string[i] == string[j]:
				flag = 1
	return flag

def find_largest_occurence(string):
	char_list = []
	len_list = []
	for i in range(1, len(string)):
		stored_str = string[0:i]
		j = i
		check_str = string[j:j + i]
		if check_str == stored_str:
			char_list.append(check_str)
			len_list.append(i)
	main_dict = dict(zip(len_list, char_list))
	return main_dict
len_string = int(input())
string = input()
flag = find_similarities(string)
if flag == 0:
	print(len_string)
else:
	val_dict = find_largest_occurence(string)
	if bool(val_dict) == True:
		max_val = max(val_dict, key=val_dict.get)
		print(len_string - max_val + 1)
	else:
		print(len_string)


print((lambda n, s: n - max([1] + [x for x in range((n >> 1) + 1) if s[:x] == s[x:2 * x]]) + 1)(int(input()), input()))


import sys
input = sys.stdin.readline

def good(d, s, i, j):
	for _ in range(d):
		if s[i] != s[j]:
			return False
		i += 1
		j += 1
	return True

def solve(n, s):
	max_j = n // 2 if n % 2 == 0 else n // 2
	best = 0
	fc = s[0]
	for j in range(1, max_j + 1):
		if fc == s[j] and good(j, s, 0, j):
			best = j
	return n - best + 1 if best > 1 else n
n = int(input())
s = input().rstrip()
print(solve(n, s))


hola = input()
a = input()
ho = 0
for i in range(1, (len(a) + 2) // 2):
	if a[0:i] == a[i:2 * i]:
		ho = i
if ho != 0:
	print(len(a) - ho + 1)
else:
	print(len(a))


n = int(input())
typestr = input()
slen = len(typestr)
ans = slen
for k in range(slen):
	if k + k - 1 < slen:
		if typestr[0:k] == typestr[k:k * 2]:
			ans = min(ans, slen - k + 1)
	else:
		break
print(ans)


n = int(input())
s = input()
ans = 0
used = False
while s:
	if len(s) % 2 == 1 or used:
		ans += 1
		s = s[:len(s) - 1]
	elif s[:len(s) // 2] == s[len(s) // 2:]:
		ans += 1
		s = s[:len(s) // 2]
		used = True
	else:
		ans += 1
		s = s[:len(s) - 1]
print(ans)


def test(k):
	if len(s) >= 2 * k:
		return s[:k] == s[k:2 * k]
	return False
n = int(input())
s = input()
d = 0
for i in range(len(s) + 1):
	if test(i):
		d = i
print(min(len(s), len(s) - 2 * d + d + 1))


n = int(input())
line = input()
if n < 4:
	print(n)
else:
	for i in reversed(range(2, n // 2 + 1)):
		start = slice(0, i)
		end = slice(i, 2 * i)
		if line[start] == line[end]:
			print(i + 1 + (n - 2 * i))
			break
		elif i == 2:
			print(n)


m = int(input())
s = input()
num = m // 2
flag = 0
for i in range(num, 1, -1):
	if s[:i] == s[i:i + i]:
		flag = 1
		break
if flag == 0:
	print(m)
else:
	print(m - i + 1)


n = int(input())
s = input()
ss = ''
i = 0
longest = 0
for i in range(int(n / 2)):
	if s[0:i + 1] == s[i + 1:i + i + 1 + 1]:
		longest = i
ans = n - longest
print(ans)


n = int(input())
s = input()
to_check = ''
mini = len(s)
for i in range(n):
	to_check += s[i]
	next = s.find(to_check, i + 1)
	if next == -1:
		continue
	elif next == i + 1:
		typing = n - len(to_check) + 1
		mini = min(mini, typing)
print(mini)


n = int(input())
s = input()
num = 0
while n > 0:
	if n % 2 != 0:
		n -= 1
		s = s[:-1]
		num += 1
	elif s[:n // 2] == s[n // 2:]:
		s = s[:n // 2]
		n //= 2
		num += n + 1
		break
	else:
		n -= 1
		s = s[:-1]
		num += 1
print(num)


n = int(input())
st = input()
ans = n
now = ''
ma = 0
for i in range(n // 2):
	now += st[i]
	t = ''
	for j in range(i + 1, 2 * i + 2):
		t += st[j]
	if t == now:
		ma = i
print(ans - ma)


n = input()
n = int(n)
str = input()
indicator = 0
Max = 0
for i in range(int(n / 2)):
	s1 = str[:i + 1]
	s2 = str[i + 1:2 * i + 2]
	if s1 == s2:
		Max = len(s1)
if Max > 0:
	print(n - Max + 1)
else:
	print(n)


n = int(input())
s = input()
for k in range(n // 2, 1, -1):
	if s[:k] == s[k:2 * k]:
		print(n - k + 1)
		exit(0)
print(n)


n = int(input())
s = input()
mini = n
for i in range(int(n / 2) + 1):
	left = s[0:i]
	length = len(s[0:i])
	right = s[i:i + length]
	if left == right:
		mini = min(mini, n - length + 1)
print(mini)


n = int(input())
s = str(input())
ans = 0
for i in range(n):
	if s[:i] + s[:i] in s[:2 * i]:
		ans = i
if ans != 0:
	print(n - ans + 1)
else:
	print(n)


n = int(input())
string = list(map(str, input()))
m = 0
for i in range(n // 2):
	if string[:i + 1] == string[i + 1:i + i + 2]:
		m = i
print(n - m)


n = int(input())
s = input()
C = n // 2
for i in range(C, 0, -1):
	if s[:i] == s[i:i + i]:
		print(n - i + 1)
		break
else:
	print(n)


N = int(input())
S = input()
copied = 1
for i in range(1, N // 2 + 1):
	if S[:i] == S[i:2 * i]:
		copied = i
print(N - copied + 1)


import sys
l = int(input())
ip = input()
i = 0
highest = 0
j = i + 1
limit = (i + l) // 2 + 1
while j < limit:
	if ip[i:j] == ip[j:j * 2] and j - i > highest:
		highest = j - i
	j += 1
if highest == 0:
	print(l)
else:
	print(l - highest + 1)


index = int(input())
str = input()
str_o = 0
while index > 0:
	if index % 2 == 1:
		index -= 1
	elif str[0:index // 2] == str[index // 2:index]:
		index = index // 2
		str_o += index + 1
		break
	else:
		index -= 1
	str_o += 1
print(str_o)


n = int(input())
s = input()
m = ''
for i in range(1, len(s)):
	if s[0:i] == s[i:i * 2] and len(s[0:i]) > len(m):
		m = s[0:i]
if len(m) == 0:
	print(len(s))
else:
	print(len(s) - len(m) + 1)


n = int(input())
s = list(input())
c = 0
if n % 2 == 1:
	del s[n - 1]
	c = 1
	n -= 1
for i in range(0, n, 2):
	if s[(n - i) // 2:] == s[:(n - i) // 2]:
		c += (n - i) // 2 + 1
		break
	c += 2
	del s[len(s) - 2:len(s)]
print(c)


def maxi(s, n):
	ans = 0
	for i in range(n):
		if s[:i] == s[i:2 * i]:
			ans = max(ans, i)
	return ans
n = int(input())
s = input()
ans = maxi(s, n)
if ans == 0:
	print(n)
else:
	print(n - ans + 1)


import sys
n = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
m = 0
for i in range(n // 2):
	l = i + 1
	if s[:l] == s[l:2 * l]:
		m = l
print(n - m + (1 if m > 0 else 0))


n = int(input())
s = input()
ans = 1e+18
for c in range(n // 2 + 1):
	curr = c + 1 + (n - 2 * c)
	if c == 0:
		curr -= 1
	s1 = s[:c] * 2
	b = True
	for i in range(len(s1)):
		if s1[i] != s[i]:
			b = False
			break
	if b:
		ans = min(ans, curr)
print(ans)


n = int(input())
s = input()
(l, j) = (0, 0)
for i in range(n // 2):
	if s[:i + 1] == s[i + 1:(i + 1) * 2]:
		l = max(l, len(s[:i + 1]))
if l > 0:
	print(n - (l - 1))
else:
	print(n)


(n, s) = (int(input()), input())
ans = n

def check(c):
	if s[:len(c)] != c:
		return 10000000000
	return len(s) - len(c)
for i in range(n):
	ans = min(ans, 1 + i + check(s[:i] + s[:i]))
print(ans)


n = int(input())
s = list(input())

def rep(n, s):
	if len(set(s)) == n:
		return n
	else:
		for i in range(n // 2, 0, -1):
			if s[:i] == s[i:i + i]:
				return n - i + 1
		return n
print(rep(n, s))


n = int(input())
s = input()
imp = 0
for i in range(n // 2, 0, -1):
	if s[:i] == s[i:2 * i]:
		imp = i
		break
print(min(n, n - imp + 1))


import math
n = int(input())
string = input()
f = 0
for i in range(math.ceil(n / 2) + 1):
	if string[:i] == string[i:i + len(string[:i])]:
		f = len(string[:i])
if f != 0:
	print(n - f + 1)
else:
	print(n)


n = int(input())
ch = input()
s = 0
d = 0
f = n
c = ''
M = 0
if ch.count(ch[0]) == n and n > 1:
	if n % 2 == 0:
		print(n // 2 + 1)
	else:
		print(n // 2 + 2)
else:
	while d < n:
		for j in range(n, d, -1):
			if ch[d:j] == c:
				s += 1
				if j - d > M:
					M = j - d
		s += 1
		c += ch[d]
		d += 1
	if M == 0:
		print(s)
	else:
		print(n - M + 1)


n = int(input())
s = str(input())
l = len(s)
prev = ''
ss = ''
max_len = 0
for i in s:
	ss += i
	if ss == s[len(ss):len(ss) + len(ss)]:
		max_len = len(ss)
if max_len > 0:
	print(l - max_len + 1)
else:
	print(l)


n = int(input())
string = list(input())
length = n
for i in range(1, n):
	if string[:i] == string[i:2 * i]:
		length = min(length, n - i + 1)
print(length)


n = int(input())
strok = input()
k_max = 0
for i in range(1, n // 2 + 1):
	if strok[:i] == strok[i:2 * i]:
		k_max = i
if k_max == 0:
	h = 0
else:
	h = 1
print(k_max + h + len(strok[2 * k_max:]))


n = int(input())
s = input()
for l in range(n // 2, 0, -1):
	if s[:l] == s[l:l * 2]:
		print(len(s) - l + 1)
		exit(0)
print(n)


n = int(input())
s = input()
(p, ad) = (0, 0)
for i in range(len(s)):
	if i % 2 == 1 and s[0:i // 2 + 1] == s[i // 2 + 1:i + 1]:
		p = i + 1
		ad = 1
print(p // 2 + n - p + ad)


b = int(input())
a = input()
c = list(a)
i = 1
steps = 1
temp = c[0]
temp2 = ''
i2 = 0
steps2 = 0
while temp != a:
	if a[len(temp):len(temp) * 2] == temp:
		temp2 = temp
		i2 = i
		steps2 = steps
		temp += c[i]
		i += 1
		steps += 1
	else:
		temp += c[i]
		i += 1
		steps += 1
if temp2 != '':
	while temp2 != a:
		if a[len(temp2):len(temp2) * 2] == temp2:
			temp2 += temp2
			i2 = len(temp2)
			steps2 += 1
		else:
			temp2 += c[i2]
			i2 += 1
			steps2 += 1
	print(steps2)
else:
	print(steps)


def fun(str):
	global count
	p = int(len(str) / 2)
	if len(str) <= 3:
		count = count + len(str)
	elif str[0:p] == str[p:]:
		count = count + len(str[0:p]) + 1
	else:
		count += 2
		str = str[:-2]
		fun(str)
n = int(input())
str = input()
count = 0
if len(str) % 2 == 0:
	fun(str)
	print(count)
else:
	count = count + 1
	str = str[:-1]
	fun(str)
	print(count)


n = int(input())
x = ' '
x += str(input())
z = 0
flag = 1
while n > 0:
	if n % 2 == 1:
		z += 1
		n -= 1
	elif n % 2 == 0:
		if x[1:n // 2 + 1] == x[n // 2 + 1:1 + n] and flag == 1:
			n = n // 2
			z += 1
			flag = 0
		else:
			n -= 1
			z += 1
print(int(z))


n = int(input())
str1 = input()
x = 0
for i in range(1, n // 2 + 1):
	if str1[:i] == str1[i:i * 2]:
		x = i
print(n - max(x - 1, 0))


n = int(input())
letters = list(input())
answer = n
for i in range(1, n):
	if letters[:i] == letters[i:2 * i]:
		answer = min(answer, n - i + 1)
print(answer)


n = int(input())
s = input()
currents = s
ans = 0
while len(currents) > 0:
	if len(currents) % 2 == 0 and currents[0:len(currents) // 2] == currents[len(currents) // 2:len(s)]:
		ans = ans + len(currents) // 2
		ans += 1
		break
	else:
		currents = currents[0:len(currents) - 1]
		ans = ans + 1
print(ans)


n = int(input())
s = input()
i = 0
c = 0
mn = n
while i < n:
	if i % 2 == 1 and s[0:i // 2 + 1] == s[i // 2 + 1:i + 1]:
		c = i // 2
	i += 1
	mn = min(mn, n if c == 0 else n - c)
print(mn)


operations = int(input())
word = input()
length = len(word)
for x in range(length // 2, 1, -1):
	if word[:x] == word[x:2 * x]:
		operations -= x - 1
		break
print(operations)


def main():
	n = int(input())
	line = input()
	ans = 0
	for i in range(50):
		if line[:i + 1] == line[i + 1:2 * (i + 1)]:
			ans = i
	print(n - ans)
main()


t = int(input())
S = input()
ans = len(S)
for i in range(int(len(S) / 2), 0, -1):
	if S[:i] == S[i:i * 2]:
		ans -= i - 1
		break
print(ans)


input()
inputString = input()
ans = 0
for i in range(len(inputString) - 1, -1, -1):
	ans += 1
	if i % 2 == 0:
		continue
	if inputString[:(i + 1) // 2] == inputString[(i + 1) // 2:i + 1]:
		ans += i // 2 + 1
		break
print(ans)
exit()


n = int(input())
s = input()
mn = len(s)
for i in range(1, len(s) // 2 + 1):
	if s[:i] == s[i:2 * i]:
		mn = len(s) - i + 1
print(mn)


x = int(input())
y = input()

def gamd(st, x, z):
	if x > 1:
		if x % 2 == 0:
			if st[0:int(x / 2)] == st[int(x / 2):]:
				print(int(x / 2) + 1 + z)
			else:
				gamd(st[0:x - 2], x - 2, z + 2)
		else:
			st = st[:x - 1]
			if st[0:int(x / 2)] == st[int(x / 2):]:
				print(int(x / 2) + 1 + z + 1)
			else:
				gamd(st[0:x - 1], x - 1, z + 1)
	else:
		print(z)
if x == 1:
	print('1')
else:
	gamd(y, x, 0)


import sys, queue, string, math, itertools
try:
	import dev_act_ffc429465ab634
	DEV = True
except:
	DEV = False

def log(*s):
	if DEV:
		print('LOG', *s)

class EJudge:

	def __init__(self, problem='default', reclim=1 << 30):
		self.problem = problem
		sys.setrecursionlimit(reclim)

	def use_files(self, infile='', outfile=''):
		if infile != '':
			self.infile = open(infile)
			sys.stdin = self.infile
		if infile != '':
			self.outfile = open(outfile, 'w')
			sys.stdout = self.outfile

	def use_bacs_files(self):
		self.use_files(self.problem + '.in', self.problem + '.out')

	def get_tl(self):
		while True:
			pass

	def get_ml(self):
		tmp = [[[5] * 100000 for _ in range(1000)]]
		while True:
			tmp.append([[5] * 100000 for _ in range(1000)])

	def get_re(self):
		s = (0,)[8]

	def get_wa(self, wstr='blablalblah'):
		for _ in range(3):
			print(wstr)
		exit()

class IntReader:

	def __init__(self):
		self.ost = queue.Queue()

	def get(self):
		return int(self.sget())

	def sget(self):
		if self.ost.empty():
			for el in input().split():
				self.ost.put(el)
		return self.ost.get()

	def release(self):
		res = []
		while not self.ost.empty():
			res.append(self.ost.get())
		return res
ej = EJudge('')
int_reader = IntReader()
fmap = lambda f, *l: list(map(f, *l))
parse_int = lambda : fmap(int, input().split())
revrange = lambda x: range(x - 1, -1, -1)
n = int(input())
s = input().strip()
for copylen in range(len(s) // 2, 0, -1):
	log(copylen, s[:copylen] * 2, s[:2 * copylen])
	if s[:copylen] * 2 == s[:2 * copylen]:
		print(len(s) - copylen + 1)
		exit()
print(len(s))


a = int(input())
b = input()
moves = 0
used = 0
while len(b) > 0:
	if b == b[:len(b) // 2] * 2 and used == 0:
		b = b[:len(b) // 2]
		moves += 1
		used = 1
	else:
		b = b[:-1]
		moves += 1
print(moves)


n = int(input())
a = input()
o = ''
m = 0
for i in range(n // 2):
	if a[:i + 1] == a[i + 1:i + i + 2]:
		m = i
print(n - m)


l = int(input())
k = input()
ans = 0
for i in range(1, l // 2 + 1):
	flag = 1
	for j in range(0, i):
		if k[j] != k[i + j]:
			flag = 0
			break
	if flag == 1:
		ans = max(ans, i)
su = l - ans
if ans > 0:
	su += 1
print(su)


import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def Z_algotithm(s):
	ls = len(s)
	lcp = [0] * ls
	lcp[0] = ls
	(i, j) = (1, 0)
	while i < ls:
		while i + j < ls and s[j] == s[i + j]:
			j += 1
		lcp[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < ls and k + lcp[k] < j:
			lcp[i + k] = lcp[k]
			k += 1
		i += k
		j -= k
	return lcp

def solve():
	n = ni()
	s = ns()
	lcp = Z_algotithm(s)
	ans = n
	for i in range(1, n):
		if lcp[i] >= i:
			ans = min(ans, n - i + 1)
	print(ans)
	return
solve()


N = int(input())
s = input().strip()
minus = 0
for i in range(len(s)):
	if s[:i + 1] == s[i + 1:i * 2 + 2]:
		minus = i
print(len(s) - minus)


a = int(input())
b = input()
x = 0
for i in range(1, int(a / 2) + 1):
	if b[:i] == b[i:i + i]:
		x = i - 1
print(a - x)


n = int(input())
s = input()
d = 0
for i in range(1, int(n / 2) + 1):
	cs = s[0:i]
	if cs == s[i:2 * i]:
		d = i - 1
print(n - d)


n = int(input())
s = str(input())
x = 0
for i in range(n):
	if s[:i] == s[i:i + i]:
		x = max(i, x)
if x:
	print(n - x + 1)
else:
	print(n)


n = int(input())
s = input()
c = ''
mini = len(s)
for i in range(len(s) // 2):
	c += s[i]
	if c == s[i + 1:i + 1 + len(c)]:
		if mini > i + 2 + len(s) - 2 * (i + 1):
			mini = i + 2 + len(s) - 2 * (i + 1)
print(mini)


n = int(input())
s = input()
cnt = -1
for i in range(n // 2 * 2, 1, -2):
	if s[:i // 2] == s[i // 2:i]:
		cnt += i // 2
		break
print(n - max(0, cnt))


n = int(input())
s = input()
dp = [10 ** 9] * (n + 1)
dp[0] = 0
for i in range(1, n + 1):
	curr = s[i - 1]
	dp[i] = min(dp[i], dp[i - 1] + 1)
for i in range(n, 0, -1):
	if 2 * i <= n and s[:i] == s[i:2 * i]:
		dp[2 * i] = min(dp[2 * i], dp[i] + 1)
for i in range(1, n + 1):
	dp[i] = min(dp[i - 1] + 1, dp[i])
print(dp[n])


n = int(input())
s = input()
changed = False
operations = n
new_s = ''
for i in reversed(range(1, n // 2 + 1)):
	if s[:i] == s[i:2 * i]:
		operations = n - i + 1
		break
print(operations)


n = int(input())
s = input()
z = [0] * n
for i in range(n):
	if 2 * i <= n:
		if s[:i] == s[i:2 * i]:
			z[i] = i
if max(z) != 0:
	print(n - max(z) + 1)
else:
	print(n)


n = int(input())
l = list(input())
i = 0
max = 0
while i <= n // 2:
	if l[:i + 1] == l[i + 1:2 * i + 2]:
		if i > max:
			max = i
	i += 1
print(len(l) - max)


n = int(input())
a = input()
ct = 0
h = 1
p = 0
t = 0
m = int(n / 2)
while 1:
	if a[0:m] == a[m:2 * m]:
		ct = n - m + 1
		break
	if m == 1:
		ct = n
		break
	m -= 1
if n == 1:
	print(1)
else:
	print(ct)


def z_algorithm(s):
	res = [0] * len(s)
	res[0] = len(s)
	(i, j) = (1, 0)
	while i < len(s):
		while i + j < len(s) and s[j] == s[i + j]:
			j += 1
		res[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < len(s) and k + res[k] < j:
			res[i + k] = res[k]
			k += 1
		(i, j) = (i + k, j - k)
	return res
n = int(input())
s = input()
z_s = z_algorithm(s)
ans = n
for i in range(n):
	if z_s[i] >= i:
		ans = min(n - i + 1, ans)
print(ans)


n = int(input())
strng = input().strip()
res = len(strng)
st = len(strng) // 2
while st > 0:
	if strng[:st] == strng[st:st * 2]:
		print(res - st + 1)
		return
	st -= 1
print(res)


R = lambda : map(int, input().split())
n = int(input())
s = input()
for i in reversed(range(n // 2)):
	if s[0:i + 1] == s[i + 1:2 * i + 2]:
		print(n - i)
		exit()
print(n)


l = int(input())
s = input()
last_i = -1
for i in range(1, l // 2 + 1):
	if s[:i] == s[i:i * 2]:
		last_i = i
if last_i == -1:
	print(l)
else:
	print(l - last_i + 1)


n = int(input())
s = input()
i = 0
d = ''
ls = []
mx = -1
while i < n:
	temp = s[0:i + 1]
	for j in range(i + 1, n + 1):
		if temp == s[i + 1:j]:
			mx = max(mx, len(temp))
	i += 1
if mx > 0:
	print(len(temp) - mx + 1)
else:
	print(len(temp))


n = int(input())
s = input()
m = -1
for i in range(len(s) // 2):
	if s[:i + 1] == s[i + 1:2 * (i + 1)]:
		m = max(m, i)
if m == -1:
	print(len(s))
else:
	print(m + 1 + 1 + len(s) - 2 * (m + 1))


n = int(input())
s = str(input())
if len(s) % 2 == 0:
	l = len(s) // 2
	h = len(s) // 2
	count = 1
	i = 0
	while l > 1 and h > 1:
		if s[:l] == s[l:l + h]:
			count = l
			break
		else:
			l = (len(s) - i) // 2
			h = (len(s) - i) // 2
		i += 2
	copy = count + 1
	left = n - 2 * count
	print(left + copy)
else:
	s = s[:len(s) - 1]
	l = len(s) // 2
	h = len(s) // 2
	count = 1
	i = 0
	while l > 1 and h > 1:
		if s[:l] == s[l:l + h]:
			count = l
			break
		else:
			l = (len(s) - i) // 2
			h = (len(s) - i) // 2
		i += 2
	copy = count + 1
	left = n - 2 * count
	print(left + copy)


n = input('')
s = input('')
l = 0
for i in range(int(len(s) / 2) + 1):
	if s[0:i] == s[i:i * 2]:
		l = i
print(min(len(s), len(s) - l + 1))


while True:
	try:

		def solution(n, s):
			i = 0
			ans = n
			while i <= n // 2:
				i += 1
				k = i
				j = 0
				frq = 0
				while k < n and j < k and (j < i):
					if s[j] != s[k]:
						break
					elif j == i - 1:
						frq += 1
						frq += n - 2 * frq
						ans = min(ans, frq + 1)
					else:
						frq += 1
					k += 1
					j += 1
			print(ans)

		def read():
			n = int(input())
			s = input()
			solution(n, s)
		if __name__ == '__main__':
			read()
	except EOFError:
		break