#include <bits/stdc++.h>
using namespace std;
int n;
string s;
bool b;
int main() {
  cin >> n >> s;
  if (n == 1 && s[0] == '0') {
    cout << "NO\n";
    return 0;
  }
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == '1' && s[i + 1] == '1') {
      cout << "NO" << endl;
      return 0;
    }
  }
  for (int i = 0; i < n - 2; i++) {
    if (s[i] == '0' && s[i + 1] == '0' && s[i + 2] == '0') {
      b = 1;
      break;
    }
  }
  if (n > 1 && s[0] == '0' && s[1] == '0') b = 1;
  if (n > 1 && s[n - 1] == '0' && s[n - 2] == '0') b = 1;
  if (!b)
    cout << "YES\n";
  else
    cout << "NO" << endl;
  return 0;
}
