#include #include #include using namespace std; using ll = long long; int main() { int n; string s; cin >> n >> s; if (n >= 3 || s == "00" || s == "11")cout << "YES" << endl; else cout << "NO" << endl; return 0; }