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