N = int(input()) S = '%' + input().rstrip() if N >= 4: print("YES") exit() for i in range(1, N): j = i while j + (j + 1 - i) <= N: if S[i:j + 1] == S[j + 1:j + (j + 1 - i) + 1]: print("YES") exit() j += 1 print("NO")