#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  string s;
  cin >> s;
  if (n == 2) {
    if ((s[0] == '1' || s[1] == '1') && !(s[0] == '1' && s[1] == '1'))
      cout << "YES";
    else
      cout << "NO";
    exit(0);
  }
  vector<int> a(s.size(), 0);
  bool b = true;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (s[i] == '1' || s[i + 1] == '1') a[i] = 1;
      continue;
    }
    if (i == n - 1) {
      if (s[i] == '1' || s[i - 1] == '1') a[i] = 1;
      continue;
    }
    if (s[i] == '1')
      if (!(s[i - 1] == '0' && s[i + 1] == '0')) {
        b = false;
        break;
      }
    if ((s[i] == '1'))
      a[i] = 1;
    else if (s[i - 1] == '1' || s[i + 1] == '1')
      a[i] = 1;
  }
  for (int i = 0; i < n; i++)
    if (a[i] == 0) {
      cout << "NO";
      exit(0);
    }
  cout << "YES";
  return 0;
}
