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

flag = 0
for i in range(n):
    if((i+1) >= n):
        l = 0
    else:
        l = i + 1
        
    if((i-1) < 0):
        r = n - 1
    else:
        r = i - 1
    
    # print(str(i)+" :"+str(l)+","+str(r))
    if(bin(a[i] != a[r] ^ a[l])):
        flag = 1
        break
        
if(flag == 0):
    print("Yes")
else:
    print("No")