#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 1;
const int mo = 1e9 + 7;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long quickpow(int a, int b) {
  long long ans = 1, pow = a;
  while (b) {
    if (b & 1) ans *= pow;
    pow *= pow;
    b >>= 1;
  }
  return ans;
}
char s[1010];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  int c = 0, p = -1;
  if (n == 1) {
    if (s[0] == '1')
      puts("Yes");
    else
      puts("No");
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (s[i] == '0')
      c++;
    else {
      if (p == -1) {
        if (c >= 2) {
          puts("No");
          return 0;
        }
      } else if (c >= 3 || c == 0) {
        puts("No");
        return 0;
      }
      p = 1;
      c = 0;
    }
  }
  if (c >= 2) {
    puts("No");
    return 0;
  }
  puts("Yes");
  return 0;
}
