#include #include int main(){ int N; char S[1000000]; scanf("%d",&N); scanf("%s",S); if(N<=2){ printf("NO\n"); } else if(strcmp(S,"101")+strcmp(S,"010")==1){ printf("NO\n"); } else{ printf("YES\n"); } return 0; }