from collections import Counter

n = int(input())

A = [int(i) for i in input().split()]
counts = Counter(A)

if len(set(A)) == 1 and A[0] == 0:
    print("Yes")
elif len(set(A)) == 2 and counts.most_common()[0][0] == 0 and counts.most_common()[0][1] == n // 3:
    print("Yes")
elif len(set(A)) == 3 and counts.most_common()[0][1] == counts.most_common()[1][1] == counts.most_common()[2][1]:
    print("Yes")
else:
    print("No")
