N = int(input()) S = input() flag = 0 for i in range(len(S)): for j in range(i, len(S)): try: a = S[i - 1:j] b = S[j : j + (j + 1 - i)] except: break if a == b: print("YES") flag = 1 break if flag == 1: break if flag != 1: print("NO")