#include <bits/stdc++.h>
using namespace std;
inline void swap(long long *a, long long *b) {
  long long temp = *a;
  *a = *b;
  *b = temp;
}
inline long long add(long long a, long long b, long long m) {
  return a + b >= m ? a + b - m : a + b;
}
inline long long sub(long long a, long long b, long long m) {
  return a - b < 0 ? a - b + m : a - b;
}
inline long long mul(long long a, long long b) {
  return a * 1ll * b % 1000000007;
}
inline long long setbits(long long a) { return __builtin_popcount(a); }
inline long long bit32(long long a) { return 31 - __builtin_clz(a); }
inline long long bit64(long long a) { return 63 - __builtin_clzll(a); }
inline long long parent(long long a) { return (a - 1) >> 1; }
long long n;
string second;
int main() {
  cin >> n;
  cin >> second;
  second = '0' + second + '0';
  bool check = true;
  for (long long i = 0; i < second.size() - 1; i++) {
    if (second[i] == '1' and second[i + 1] == '1') {
      check = false;
      break;
    }
  }
  bool flag = false;
  long long cnt = 0;
  for (long long i = 0; i < second.size(); i++) {
    if (second[i] == '0') cnt++;
    if (second[i] == '1') cnt = 0;
    if (cnt == 3) flag = true;
  }
  if (check and !flag)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
