from collections import Counter
n = int(input())
a = Counter(map(int,input().split()))
a = a.items()
a = sorted(a,key=lambda x: x[1],reverse=1)
if n % 3 != 0 or len(a) > 3:
  f = 1
elif len(a) == 3:
  b,c,d = a[0][0],a[1][0],a[2][0]
  if b^d != c or c^b != d or d^c != b:
    f = 1
  elif a[0][1] == a[1][1] == a[2][1]:
    f = 0
  else:
    f = 1
elif len(a) == 2:
  b,c,d = a[0][0],a[0][0],a[1][0]
  if b^d != c or c^b != d or d^c != b:
    f = 1
  elif a[0][1] == 2*a[1][1]:
    f = 0
  else:
    f = 1
else:
  b,c,d = a[0][0],a[0][0],a[0][0]
  if b^d != c or c^b != d or d^c != b:
    f = 1
  else:
    f = 0
print('YNeos'[f::2])