using System; public class Hello { static void Main() { Console.ReadLine(); var s = Console.ReadLine().Trim(); getAns(s); } static bool calc(string s, string t) => s.IndexOf(t) != -1; static void getAns(string s) { if (calc(s, "00")) { Console.WriteLine("YES"); return; } if (calc(s, "11")) { Console.WriteLine("YES"); return; } if (calc(s, "1010")) { Console.WriteLine("YES"); return; } if (calc(s, "0101")) { Console.WriteLine("YES"); return; } Console.WriteLine("NO"); } }