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