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

a = list(set(A))

ans = "No"

if len(a) == 1:
    if a == [0]:
        ans = "Yes"
elif len(a) == 2:
    if N % 3 == 0 and A.count(0) == N//3:
        ans = "Yes"
elif len(a) == 3:
    if N % 3 == 0 and (A.count(a[0]),A.count(a[1]),A.count(a[2])) == (N//3,N//3,N//3):
        ans = "Yes"

print(ans)