N = int(input())
a = list(map(int, input().split()))[:N]
a.append(a[0])

xorNeighbor = 0
for i in range(1, len(a)-1):
    #print(a[i-1], a[i], a[i+1])
    xorNeighbor += (a[i-1] ^ a[i] ^ a[i+1])

if xorNeighbor:
    print("No")
else:
    print("Yes")