n=int(input())
a=list(map(int,input().split()))
a_2=[]
for i in range(len(a)):
    a_2.append(bin(a[i]))
import collections
c = collections.Counter(a)
b=[]
for i in c.values():
    b.append(i)
for i in range(len(b)):
    if len(b)%3!=0:
        print('No')
        break
    elif b[i]!=b[i+1] and i!=len(b)-2:
        print('No')
        break
    elif i==len(b)-2:
        print('Yes')
        break
    else:
        pass