R = lambda: list(map(int, input().split()))

 

n = int(eval(input()))

if n % 3:

    ans = 'YNeos'[any(R())::2]

else:

    a = sorted(R())

    m = n // 3

    if a[0] ^ a[m] ^ a[2 * m]:

        ans = 'No'

    elif any(a[i] != a[i - 1] for i in range(1, n) if m != i != 2 * m):

        ans = 'No'

    else:

        ans = 'Yes'

print(ans)

R = lambda: list(map(int, input().split()))

 

n = int(eval(input()))

if n % 3:

    ans = 'YNeos'[any(R())::2]

else:

    a = sorted(R())

    m = n // 3

    if a[0] ^ a[m] ^ a[2 * m]:

        ans = 'No'

    elif any(len(set(a[i:i + m])) > 1 for i in range(0, n, m)):

        ans = 'No'

    else:

        ans = 'Yes'

print(ans)
R = lambda: list(map(int, input().split()))
n = int(eval(input()))
if n % 3:
    ans = "YNeos"[any(R()) :: 2]
else:
    a = sorted(R())
    m = n // 3
    if a[0] ^ a[m] ^ a[2 * m]:
        ans = "No"
    elif any(a[i] != a[i - 1] for i in range(1, n) if m != i != 2 * m):
        ans = "No"
    else:
        ans = "Yes"
print(ans)

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

-    elif any(a[i] != a[i - 1] for i in range(1, n) if m != i != 2 * m): +    elif any(len(set(a[i : i + m])) > 1 for i in range(0, n, m)):