N = int(raw_input()) S = raw_input() flag = False for i in range(N): for j in range(i,N): if j + (j + 1 - i) >= N:break if j + 1 >= N:break if S[i:j] == S[j + 1:j + (j + 1- i)]: flag = True if flag: break print ('YES' if flag else 'NO')