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