from collections import Counter

n = int(input())
l = list(map(int, input().split()))
d = Counter(l)
if len(d) != 3:
    print('No')
else:
    x = list(d.items())
    if d[x[0]] == d[x[1]] and d[x[1]] == d[x[2]]:
        print('Yes')
    else:
        print('No')
