R = lambda: map(int, input().split())
 
n = int(input())
if n % 3:
    ans = 'YNeos'[any(R())::2]
else:
    a = sorted(R())
    m = n // 3
    r = range(0, n, m)
    ans = 'YNeos'[a[0] ^ a[m] ^ a[2 * m] or any(len(set(a[i:i + m])) > 1 for i in r)::2]
print(ans)