from collections import Counter as ct
import sys
input = sys.stdin.readline

n = int(input())
a = input().split()
c = ct(a)
if c["0"] == n:
    print("Yes")
elif len(c) == 2 and c["0"] * 3 == n:
    print("Yes")
elif len(c) == 3 and c[0] == c[1] and c[1] == c[2]:
    print("Yes")
else:
    print("No")