n = gets.to_i
s = gets.chomp
ans = 0
(1...n).each do |i|
  former = s[0...i]
  latter = s[i...n]
  ans = i if latter.include?(former) && ans < i
  ans = n - i if former.include?(latter) && ans < n - i
end
puts ans
