#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 1;
  if (n == 1) {
    if (s[0] == '0') {
      cout << "NO";
    } else {
      cout << "YES";
    }
    return 0;
  } else if (n == 2) {
    if (s[0] == s[1]) {
      cout << "NO";
    } else {
      cout << "YES";
    }
    return 0;
  }
  if (s.find("11") != -1) {
    ans = 0;
  }
  if (s.find("000") != -1) {
    ans = 0;
  }
  if ((s[0] == '0' && s[1] == '0') || (s[n - 2] == '0' && s[n - 1] == '0')) {
    ans = 0;
  }
  if (ans == 0) {
    cout << "NO";
  } else {
    cout << "YES";
  }
  return 0;
}
