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