from collections import Counter
N = int(input())
a_array = list(map(int,input().split()))

a = Counter(a_array)

if len(a) == 1 and a[0] == N:
    print("Yes")
    exit()


if len(a) == 3:
    for d in a.values():
        if d != N // 3:
            print("No")
            exit()
    else:
        print("Yes")
        exit()
else:
    print("No")
    exit()
