import sys

input = sys.stdin.readline


def main():
    n = int(input())
    a_list = [int(i) for i in input().split()]
    kind = set(a_list)
    if len(kind) not in (2, 3):
        print("No")
        return
    # 1 0 1
    # 1 2 3
    if len(kind) == 3:
        if n % 3 != 0 or len(set([a_list.count(k) for k in kind])) != 1:
            print("No")
            return
        kind = list(kind)
    else:
        a, b = kind
        a_c, b_c = a_list.count(a), a_list.count(b)
        if 0 not in kind or abs(a_c - b_c) > 1:
            print("No")
            return
        if a == 0:
            if a_c > b_c:
                print("No")
                return
            kind = [b, a, b]
        else:
            if b_c > a_c:
                print("No")
                return
            kind = [a, b, a]
    kind.extend([kind[0], kind[-1]])
    for i in range(3):
        if kind[i] != kind[i - 1] ^ kind[i + 1]:
            print("No")
            return

    print("Yes")


if __name__ == "__main__":
    main()
