#!/usr/bin/env python
from collections import defaultdict, deque
import math
from math import factorial
import fractions
import re

BIGNUM = 10 ** 9 + 7

def convtobit(x):
    b = bin(x)
    bits = list(map(int, b[2:]))
    bits = [0] * (32 - len(bits)) + bits
    return tuple(bits)

def minus(x, y):
    b = []
    for xb, yb in zip(x, y):
        bit = 1 if xb != yb else 0
        b.append(bit)
    return tuple(b)

def main():
    #A, B, C, K = map(int, input().split())
    N = int(input())
    As = list(map(int, input().split()))

    # find N-th and 2nd number
    first = convtobit(As[0])
    As = As[1:]
    Adict = defaultdict(int)
    for a in As:
        b = convtobit(a)
        Adict[b] += 1

    assert convtobit(2) == tuple([0]*30 + [1, 0])
    assert convtobit(7) == tuple([0]*29 + [1, 1, 1])

    N_seconds = []
    for a in As:
        a = convtobit(a)
        wanted = minus(first, a)
        if wanted in Adict:
            if wanted != a or (wanted == a and Adict[a] >= 2):
                N_seconds.append((wanted, a))

    if not N_seconds:
        print("No")
        return

    for Nth, second in N_seconds:
        adict = dict(Adict)
        adict[Nth] -= 1
        adict[second] -= 1

        is_failure = False
        prev = (first, second)
        for i in range(N-3):
            next_th = minus(prev[1], prev[0])
            if next_th in adict and adict[next_th] > 0:
                adict[next_th] -= 1
                prev = (prev[1], next_th)
            else:
                is_failure = True
                break

        if not is_failure:
            next_th = minus(prev[1], prev[0])
            if next_th == Nth:
                print("Yes")
                return

    print("No")

if __name__ == '__main__':
    main()
