N=int(input())
a=list(map(int, input().split()))
A=0
for i in range(N):
  Be=a[len(a)-1] if i==0 else a[i-1]
  Af=a[0] if i==len(a)-1 else a[i+1]
  A+=Be^Af

if sum(a)==A:
  print('Yes')
else:
  print('No')