input() print("YES" if "00" in (S := input()) or "11" in S else "NO")