N=int(input())
A = list(map(int,input().split()))
if(N % 3 != 0):
    print('No')
a = -1
b = -1
c = -1
aa = A[0]

a = A.count(aa)

bb = -1

for i in A:
    if(aa != i):
        bb = i
        break
b = A.count(bb)
if(a == b):
    cc = -1

    for i in A:
        if(aa != i and bb != i):
            cc = i
            break
    c = A.count(cc)
    if(b == c):
        print('Yes')
    else:
        print('No')
else:
    print('No')