from collections import Counter
n = int(input())
a = list(map(int, input().split()))
l = len(set(a))
if l > 3:
	print("No")
elif l == 1:
	if a[0] == 0:
		print("Yes")
	else:
		print("No")
elif n%3 != 0:
	print("No")
elif l == 2:
	if 0 not in set(a):
		print("No")
	elif a.count(0) == n//3:
		print("Yes")
	else:
		print("No")
else:
	for x in list(set(a)):
		if a.count(x) != n//3:
			print("No")
			break
	else:
		print("Yes")