#include <bits/stdc++.h>
using namespace std;
bool maximal(string &s) {
  int len = s.size();
  int maxVal = 0;
  int count = 0;
  for (int i = 0; i < len; i++) {
    if (i < len - 1 && s[i] == s[i + 1] && s[i] == '1') return 0;
    if (s[i] == '0')
      count++;
    else
      count = 0;
    if (maxVal < count) maxVal = count;
  }
  if (len == 1 && maxVal == 1) return 0;
  if (len == 2) {
    if (maxVal == 0 || maxVal == 2) return 0;
    return 1;
  }
  if (len == 3 && maxVal == 2) return 0;
  if (maxVal > 2) return 0;
  if (len > 2) {
    if ((s[0] == '0' && s[1] == '0') ||
        (s[len - 1] == '0' && s[len - 2] == '0'))
      return 0;
  }
  return 1;
}
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  if (maximal(s))
    cout << "yes" << endl;
  else
    cout << "no" << endl;
  return 0;
}
