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

flag1 = True
flag2 = True

for i in a:
    if a != 0:
        flag1 = False
        break

if not flag1:
    if n % 3 != 0:
        flag2 = False
    if flag2:
        a.sort()
        a11 = a[0: n // 3]
        a12 = a[n // 3: 2 * n // 3]
        a13 = a[2 * n // 3:]
        if not (a11.count(a11[0]) == a12.count(a12[0]) == a13.count(a13[0])):
            flag2 = False
    if flag2:
        a1, a2, a3 = a[0], a[n // 3], a[2 * n // 3]
        aa = [[], [], []]
        for i in range(30):

            aa[0].append(a1 % 2)
            aa[1].append(a2 % 2)
            aa[2].append(a3 % 2)
            a1 = a1 // 2
            a2 = a2 // 2
            a3 = a3 // 2

        for i in range(30):
            if aa[0][i] == 0 and aa[1][i] == 0 and aa[2][i] == 1:
                flag2 = False
                break
            if aa[0][i] == 0 and aa[1][i] == 1 and aa[2][i] == 0:
                flag2 = False
                break
            if aa[0][i] == 1 and aa[1][i] == 0 and aa[2][i] == 0:
                flag2 = False
                break
            if aa[0][i] == 1 and aa[1][i] == 1 and aa[2][i] == 1:
                flag2 = False
                break


if flag1 or flag2:
    print("Yes")
else:
    print("No")
