from collections import Counter
n = int(input())
A = list(map(int, input().split()))
ans = "No"
Co = Counter(A)
if n%3 == 0:
    tr = n//3
    Va = Co.values()
    if len(Va) == 3:
        if Co.most_common()[0][1] == Co.most_common()[1][1] == Co.most_common()[2][1]:
            ans = "Yes"
    elif len(Va) == 2 and Co.most_common()[0][1] == 2*tr:
        ans = "Yes"

print(ans)