#include #include #include #include #include #include #include #include #include #include #include #include #include #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) #define var auto #define mod 1000000007 #define inf 2147483647 typedef long long ll; using namespace std; int inputValue(){ int a; cin >> a; return a; } template void output(T a, int precision) { if(precision > 0){ cout << fixed << setprecision(precision) << a << "\n"; } else{ cout << a << "\n"; } } // end of template int main() { // source code int N = inputValue(); string s; cin >> s; if (N == 1) { output("NO", 0); return 0; } else if(s == "01" || s == "10" || s == "101" || s == "010"){ output("NO", 0); return 0; } output("YES", 0); return 0; }