#include <bits/stdc++.h>
int main() {
  int n, i;
  scanf("%d", &n);
  char a[100000];
  for (i = 0; i < n; i++) {
    scanf("%s", &a[i]);
  }
  if (n == 1) {
    if (a[0] == '0') {
      printf("No");
    } else
      printf("Yes");
    exit(0);
  }
  for (i = 0; a[i] != '\0'; i++) {
    if ((a[i] == '0') && (a[i - 1] == '0') && (a[i + 1] == '0') ||
        ((a[i] == '1') && (a[i] == a[i + 1])) ||
        ((a[0] == '0') && (a[1] != '1')) ||
        ((a[strlen(a) - 1] == '0' && (a[strlen(a) - 2] != '1')))) {
      printf("No");
      exit(0);
    }
  }
  printf("Yes");
}
