element_count = int(input())
arr = list(map(int,input().split()))
counts = set()
for i in range(1,10):
counts.add(arr.count(i))
if element_count < 9:
print("NO")
else:
if max(counts) - min(counts) <= 1:
print("YES")
else:
print("NO")

京公网安备 11010502036488号