#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  char ch = s[0];
  if (n == 1 && s[0] == '0') {
    cout << "No";
    return 0;
  }
  int c = 1;
  bool a = 0;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == ch)
      ++c;
    else {
      if (ch == '1' && c >= 2 || ch == '0' && c >= 3) a = 1;
      c = 1;
    }
    ch = s[i];
  }
  if (ch == '1' && c >= 2 || ch == '0' && c >= 3) a = 1;
  if (s.size() >= 2 && s[0] == s[1] && s[1] == '0' ||
      s.size() >= 2 && s[s.size() - 1] == s[s.size() - 2] &&
          s[s.size() - 2] == '0')
    a = 1;
  if (a)
    cout << "No";
  else
    cout << "Yes";
}
