import re input() p = re.compile(r"00|0101|11|1010") print("YNEOS"[p.search(input()) is None :: 2])