import sys
input = sys.stdin.readline
from collections import Counter
def judge(vals):
    return vals[0] ^ vals[1] ^ vals[2] == 0
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = "No"
    c = Counter(A)
    if N % 3 == 0:
        if (len(c) == 2 and c[0] * 3 == N) or (len(c) == 3 and sum(c.values()) == N and judge(list(c.keys()))):
            ans = "Yes"
    else:
        if c[0] == N:
            ans = "Yes"
    print(ans)
if __name__ == "__main__":
    main()