#include #include #include #include using namespace std; int main(void) { int N; cin >> N; string s; cin >> s; if (N >= 4) { cout << "YES" << endl; return 0; } if (N <= 3) { bool f = false;; for (int i = 0; i < N-1; ++i) { f = (f | (s[i] == s[i + 1])); } if (f) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }