#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long int> v;
  for (long long int i = 0; i < s.size(); i++) {
    if (s[i] == '1') v.push_back(i);
  }
  if (v.size() == 0) {
    cout << "NO";
    exit(0);
  }
  for (long long int i = 0; i < v.size() - 1; i++) {
    if (v[i + 1] - v[i] == 1 || v[i + 1] - v[i] > 3) {
      cout << "NO";
      exit(0);
    }
  }
  if (v[0] > 1 || v.back() < n - 2)
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
