#define FOR(i, a, b) for (int i = (a); i < (b); i++) #define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--) #define REP(i, n) for (int i = 0; i < (n); i++) #define RREP(i, n) for (int i = (n)-1; i >= 0; i--) #define MIN(a, b) (a > b ? b : a) #define MAX(a, b) (a > b ? a : b) #include using namespace std; int N; string S; void solve() { cin >> N >> S; if (N == 1) { cout << "NO" << endl; } else if (N == 2) { cout << (S[0] == S[1] ? "YES" : "NO") << endl; } else if (N == 3) { cout << (S[0] == S[1] || S[1] == S[2] ? "YES" : "NO") << endl; } else if (N >= 4) { cout << "YES" << endl; } } int main() { solve(); return 0; }