#include #include #include #include #include #include #include #include #include #include #include #include //#include "toollib.h" #define INT_MAX 2147483647 #define Loop(i, n) for(int i = 0; i < (int)n; i++) #pragma warning (disable:4018) using namespace std; typedef long long int lint; typedef struct { int x; int y; }coordinate; //***** Main Program ***** int main() { int N; string S; cin >> N >> S; if (N == 1) cout << "NO" << endl; else if (N == 2) { if (S == "10" || S == "01") cout << "NO" << endl; else cout << "YES" << endl; } else if (N == 3) { if (S == "010" || S == "101") cout << "NO" << endl; else cout << "YES" << endl; } else cout << "YES" << endl; return 0; }