n=int(input()) s=input() if n%2: print("YES") exit() for i in range(n//2): if s[i]==s[~i]: print("YES") exit() for i in range(1,n//2): if s[i-1]+s[i]==s[~i]+s[(~i)+1]: print("YES") exit() print("NO")