#include <bits/stdc++.h>
int main() {
  int a;
  while (~scanf("%d", &a)) {
    getchar();
    char b[1010] = {0};
    int a1, a0, y = 0;
    scanf("%c", &b[0]);
    if (a >= 2) {
      scanf("%c", &b[1]);
      if (b[1] == b[0]) {
        y = 1;
      }
      if (b[1] == '0')
        a0 = 1;
      else
        a0 = 0;
      for (int i = 2; i < a; i++) {
        scanf("%c", &b[i]);
        if (b[i] == b[i - 1] && b[i] == '0')
          a0++;
        else if (b[i] == b[i - 1] && b[i] == '1') {
          y = 1;
        } else if (b[i] != b[i - 1] && b[i] == '0')
          a1 = 1;
        else if (b[i] != b[i - 1] && b[i] == '1')
          a0 = 1;
        if (a0 >= 3) {
          y = 1;
        }
      }
    }
    if (y == 1 || (a == 1 && b[0] == '0'))
      printf("No\n");
    else if (b[a - 1] == b[a - 2])
      printf("No\n");
    else
      printf("Yes\n");
  }
  return 0;
}
