from collections import Counter


def solve(n, aaa):
    if n % 3 != 0:
        return False

    cnt = list(Counter(aaa).items())
    if len(cnt) == 2:
        (a1, c1), (a2, c2) = cnt
        if c1 > c2:
            c1, c2 = c2, c1
        if c1 != n // 3 or c2 != n * 2 // 3:
            return False
        return a1 == 0

    if len(cnt) == 3:
        if any(c[1] != n // 3 for c in cnt):
            return False
        a1, a2, a3 = (c[0] for c in cnt)
        return a1 ^ a2 == a3
   
    return False


n = int(input())
aaa = list(map(int, input().split()))
print('Yes' if solve(n, aaa) else 'No')
