n = int(input())
a_list = list(map(int, input().split()))
a_len = len(a_list)

flag = True
for i in range(a_len):

    next_n = (i+1) % a_len
    pre_n = i-1
    side = a_list[pre_n] ^ a_list[next_n]

    if side != a_list[i]:
        flag = False
        break

if flag:
    print('Yes')
else:
    print('No')
