n=input() s=raw_input() def mys(s,a,b): return s[a-1:b] if n>3: print"YES" else: for i in range(1,n+1): for j in range(i,n+1): if j+j+1-i<=n and mys(s,i,j)==mys(s,j+1,j+j+1-i): print"YES" exit() print"NO"