import sys
input = sys.stdin.readline

N = int(input())
a = [int(i) for i in input().split()]

from collections import Counter

Count_a = Counter(a)

if Count_a[0] == N:
    print("Yes")
    exit()

if N % 3 != 0:
    print("No")
    exit()

if len(Count_a) == 2:
    if Count_a[0] == N // 3:
        print("Yes")
    else:
        print("No")
elif len(Count_a) == 3:
    three = [k for k,_ in Count_a.items()]
    if three[0] ^ three[1] == three[2]:
        for i in range(3):
            if Count_a[three[i]] != N // 3:
                print("No")
                exit()
        print("Yes")
else:
    print("No")