import sys

input = sys.stdin.readline


def main():
    n = int(input())
    a_txt = input().strip()
    a_list = [int(i) for i in a_txt.split()]
    if n % 3 != 0 or len(set(a_list)) != 3:
        print("No")
        return
    a_list.extend([a_list[0], a_list[-1]])
    for i in range(3):
        if a_list[i] != a_list[i - 1] ^ a_list[i + 1]:
            print("No")
            return
    expect = a_list[:3] * (n // 3)
    if " ".join(map(str, expect)) == a_txt:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
