from collections import Counter
N = int(input())
a = [int(i) for i in input().split()]

c = Counter(a)

if c[0] == N:
    print("Yes")
    exit()

if c[0] == N//3 and len(c.values()) == 2:
    print("Yes")
    exit()

n =  N // 3
if list(c.values()) == [n, n, n]:
    print("Yes")
    exit()

print("No")