using System; namespace No290 { class MainClass { public static void Main (string[] args) { var n = Convert.ToInt32(Console.ReadLine ()); var s = Console.ReadLine (); if (n == 1) { Console.WriteLine ("NO"); return; } if (n == 2) { if(s.Equals("01")) { Console.WriteLine ("NO"); return; } if(s.Equals("10")) { Console.WriteLine ("NO"); return; } } if (n == 3) { if(s.Equals("010")) { Console.WriteLine ("NO"); return; } if(s.Equals("101")) { Console.WriteLine ("NO"); return; } } Console.WriteLine("YES"); } } }