from collections import Counter

n = int(input())
a = list(map(int, input().split()))
ca = Counter(a)

if 0 in ca and ca[0] == n:
    print("Yes")
elif 0 in ca and ca[0] == n // 3:
    # x 0 x x 0 x (x)
    for c in ca:
        if ca[c] == 2 * n // 3:
            print("Yes")
    else:
        print("No")
else:
    values = []
    for c in ca:
        if ca[c] == n // 3:
            values.append(c)
    if len(values) == 3:
        print("Yes")
    else:
        print("No")