# https://atcoder.jp/contests/agc035/tasks/agc035_a
import numpy as np


def calc(N: int, values: np.ndarray) -> bool:
    return any([calc3(N, values), calc_0_1(N, values)])


def calc3(N: int, values: np.ndarray) -> bool:
    if N % 3 != 0:
        return False

    uniques = np.unique(values)
    if len(uniques) != 3:
        return False

    counts = [np.sum(values == v) for v in uniques]  # 各固有値の格納数
    if len(np.unique(counts)) != 1:
        return False

    sorted_uniques = np.sort(uniques)
    return all(
        [
            sorted_uniques[0] == np.bitwise_xor(sorted_uniques[1], sorted_uniques[2]),
            sorted_uniques[1] == np.bitwise_xor(sorted_uniques[2], sorted_uniques[0]),
            sorted_uniques[2] == np.bitwise_xor(sorted_uniques[0], sorted_uniques[1]),
        ]
    )


def calc_0_1(N: int, values: np.ndarray) -> bool:
    """
    0000...0 and 1111...1 only pattern
    """
    if N < 3:
        return False

    max_value = np.max(values)
    # max value must be 1111...1
    if not number_is_all_bit_1(max_value):
        return False

    uniques = np.unique(values)
    if set(uniques) != {0, max_value}:
        return False

    counts = {v: np.sum(values == v) for v in uniques}  # 各固有値の格納数
    if (counts[1] == counts[0] + 1) or (counts[0] == counts[1]):
        return True

    return False


def number_is_all_bit_1(value: int) -> bool:
    if value == 0:
        return False
    if value == 1:
        return True
    ex = 1
    compare = 2
    while compare - 1 <= value:
        if value == compare - 1:
            return True
        ex += 1
        compare = 2 ** ex

    return False


def load_input_as_int_array():
    return np.array([int(v) for v in input().split(" ")])


N = int(input())
values = load_input_as_int_array()
result = calc(N, values)

if result:
    print("Yes")
else:
    print("No")
