#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define D long long #define U unsigned using namespace std; D n, m,a, b, d, e, x, y, z; D i, j, k; char c,f; string s; D ans; int main() { D t; cin >>a>>s; if (s == "010" || s == "101" || s == "01" || s == "10" || s == "0" || s == "1") cout << "NO" << endl; else cout << "YES" << endl; }