N = input() S = list(raw_input()) if N <= 1: print "NO" else: for i in xrange(N-1): if S[i] == S[i+1]: print "YES" exit() else: print "NO"