def main():
    n = int(input())
    from collections import Counter
    ls = Counter(map(int, input().split()))
    print('YNeos'[not check(n, ls)::2])

def check(n, ls):
    key = list(ls.keys())
    val = list(ls.values())
    if key[0] == 0 and val[0] == n:
        return True
    elif len(key) <= 3 and n % 3 == 0:
        for v in val:
            if v != n / 3: return False
        if key[-2] ^ key[-1] == key[0] or key[-1] ^ key[0] == key[-2]: return True
        for i in range(len(key)-2):
            if key[i] ^ key[i+1] == key[i+2]: return True
        return False
    else:
        return False

if __name__ == '__main__':
    main()