#include #include using namespace std; void fail() {cout << "NO\n";exit(0);} void success() {cout << "YES\n";exit(0);} int main() { int N;string S;cin>>N>>S; if(N == 1 || (N == 2 && S[0] != S[1]) || (N == 3 && S[0] != S[1] && S[1] != S[2])) fail(); success(); return 0; }