n = gets.to_i str = gets n.times do |i| 0.upto(n - i * 2 - 2) do |j| ji = j + i if str[j..ji] == str[ji + 1..2 * ji - j + 1] puts "YES" exit end end end puts "NO"