n = int(input())
a = list(map(int,input().split()))
flag = True
for i in range(1,len(a)+1) :
  if a[i-1]^a[i+1] != a[i] :
    flag = False
if a[n-1] != a[n-2]^a[0] or a[0] != a[1]^a[n-1] :
  flag = False
if flag :
  print('Yes')
else :
  print('No')