#include <bits/stdc++.h>   using namespace std;   int main() {     int n;     while (cin >> n) {       string str;       cin >> str;       bool flag = true;       if (n < 3) {         if (n == 1) {           if (str[0] ==  1 )             cout <<  Yes  << endl;           else             cout <<  No  << endl;         } else {           if (str !=  00  && str !=  11 )             cout <<  Yes  << endl;           else             cout <<  No  << endl;         }         continue;       }       for (int i = 0; i < n - 2; i++) {         int ans = 0;         for (int j = i; j < i + 3; j++) {           ans += str[j] -  0 ;         }         if (ans == 1)           continue;         else if (ans == 0 || ans == 3) {           flag = false;           break;         } else {           if (str[i + 1] !=  0 ) {             flag = false;             break;           }         }       }       if (str[0] ==  0  && str[1] ==  0  && str[2] ==  1 ) flag = false;       if (str[n - 1] ==  0  && str[n - 2] ==  0  && str[n - 3] ==  1 )         flag = false;       if (flag)         cout <<  Yes  << endl;       else         cout <<  No  << endl;     }   }   