import sys

input = sys.stdin.readline


def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]
    a_list.extend([a_list[0], a_list[-1]])
    for i in range(n):
        if a_list[i] != a_list[i - 1] ^ a_list[i + 1]:
            print("No")
            return
    print("Yes")


if __name__ == "__main__":
    main()