#include <bits/stdc++.h>
using namespace std;
int n;
int arr[1005];
int main() {
  cin >> n;
  string s;
  cin >> s;
  if (n == 1) {
    if (s[0] == '1') {
      cout << "YES";
      return 0;
    }
    cout << "NO";
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    if (s[i] == '1')
      arr[i] = 1;
    else
      arr[i] = 0;
  }
  bool ok = true;
  for (int i = 1; i < n; ++i) {
    if (arr[i] == 1 && arr[i - 1] == 1) {
      ok = false;
      i = n;
    }
  }
  bool two = true;
  if (arr[0] == 0 && arr[1] == 0) two = false;
  if (arr[n - 1] == 0 && arr[n - 2] == 0) two = false;
  for (int i = 0; i < n - 2; ++i) {
    if (arr[i] == 0 && arr[i + 1] == 0 && arr[i + 2] == 0) {
      two = false;
    }
  }
  if (ok && two)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
