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

l = a[0]
m = -1
n = -1

for i in range(1,N):
    if a[i] != l and m == -1:
        m = a[i]
    if a[i] != l and a[i] != m and m != -1:
        n = a[i]

if n == -1:
    print("No")
elif (a.count(l)==a.count(m) and a.count(m)==a.count(n) and a.count(l)+a.count(m)+a.count(n) == N):
    print("Yes")
else:
    print("No")