def main(): n, s = int(input()), input() if n > 3: print("YES") elif n > 1: for i in range(n-1): if s[i] == s[i+1]: print("YES") break else: print("NO") else: print("NO") if __name__ == "__main__": main()