#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  s = "0" + s + "0";
  if (s.find("000") != string::npos || s.find("11") != string::npos)
    puts("NO");
  else
    puts("YES");
  return 0;
}
