import sys

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

if n % 3 != 0:
    print("No")
    sys.exit()

is_fulfill = False

is_zero = list(filter(lambda x: x == 0, a))
if len(is_zero) == 0:
    is_fulfill = True

if not is_fulfill:
    is_zero = list(filter(lambda x: x == 0), a)
    if len(is_zero) == n / 3:
        a_not_zero = list(filter(lambda x: x != 0, a))
        a_x = list(filter(lambda x: x == a_not_zero[0], a_not_zero))
        if len(a_x) == 2 * n / 3:
            is_fulfill = True

if not is_fulfill:
    x = a[0]
    is_y = False
    for i in a:
        if i != x:
            y = i
            is_y = True
            break
    if not is_y:
        print("No")
        sys.exit()
    is_z = False
    for i in a:
        if i != x and i != y:
            z = i
            is_z = True
            break
    if not is_z:
        print("No")
        sys.exit()

    if x ^ y ^ z == 0:
        a_x = list(filter(lambda l: l == x, a))
        if len(a_x) == n / 3:
            a_y = list(filter(lambda x: x == y, a))
            if len(a_y) == n / 3:
                is_fulfill = True

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