import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) S = read().rstrip().decode() if N > 4: print('YES') exit() answer = 'NO' for i in range(N): for j in range(i,N): if S[i:j+1] == S[j+1:j-i+2]: answer = 'YES' print(answer)