#include "bits/stdc++.h" using namespace std; #define REP(i, n) for(int i=0; i<(n); i++) int N,T; string S; signed main() { cin >> N >> S; if (N == 1) { cout << "NO" << endl; return 0; } if (N >= 4) { cout << "YES" << endl; return 0; } int prev = -1; for (auto&& t : S) { if (t == prev) { cout << "YES" << endl; return 0; } prev = t; } cout << "NO" << endl; return 0; }