N = int(input())
A = list(map(int, input().split()))

import collections
dic=dict(collections.Counter(A))
li=list(dic.values())

ans='No'
if N%3 == 0:
    if len(li)==3:
        if li[0]==li[1] and li[0]==li[2]:
            ans='Yes'
else:
    if len(li)==1:
        if dic.keys[0]==0:
            ans='Yes'

print(ans)