N = int(input())
a = list(map(int, input().split()))

l = a[0]
m = -1
n = -1
o = -1

for i in range(1,N):
    if a[i] != l and m == -1:
        m = a[i]
    if a[i] != l and a[i] != m and m != -1:
        n = a[i]
    if a[i] != l and a[i] != m and m != -1 and a[i] != n and n != -1:
        o = a[i]
        break

if o != -1:
    print("No")
elif (a.count(l)==a.count(m) and a.count(m)==a.count(n) and a.count(l)+a.count(m)+a.count(n) == N):
    print("Yes")
elif n == -1 and ((a.count(l) == a.count(m)*2 and l^m == l and a.count(l)+a.count(m)==N)or(a.count(l)*2 == a.count(m) and l^m == m and a.count(l)+a.count(m)==N)):
    print("Yes")
else:
    print("No")