#include <bits/stdc++.h>
using namespace std;
int n;
char d[1007];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> d[i];
  }
  if (n == 1) {
    if (d[0] == '1')
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    return 0;
  }
  if (n == 2) {
    if (d[0] != d[1])
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    return 0;
  }
  for (int i = 1; i < n - 1; i++) {
    if (d[i] == '1') {
      if (!(d[i - 1] == '0' && d[i + 1] == '0')) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  for (int i = 1; i < n - 1; i++) {
    if (d[i] == '0') {
      if (d[i - 1] == '0' && d[i + 1] == '0') {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  if (d[0] == '0' && d[1] == '0') {
    cout << "NO" << endl;
    return 0;
  }
  if (d[n - 2] == '0' && d[n - 1] == '0') {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  return 0;
}
