#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string a;
  cin >> a;
  int flag = 1, j, count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == '1') {
      count = 0;
      if (i != 0) {
        if (a[i - 1] == '1') {
          flag = 0;
          break;
        }
      }
    } else if (a[i] == '0') {
      count++;
    }
    if (count >= 3 || (count == 2 && i == n - 1) || (count == 2 && i == 1)) {
      flag = 0;
      break;
    }
  }
  if (n == 1) {
    if (a[0] == '1')
      flag = 1;
    else
      flag = 0;
  }
  if (flag == 0)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
