import sys

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

is_3n = True
if n % 3 != 0:
    is_3n = False

is_fulfill = False
if is_3n:
    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 is_y and is_z and 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")