import sys
from collections import Counter
n = int(input())
l = list(map(int, sys.stdin.readline().strip().split()))
cnt = Counter(l)
if max(cnt.values()) - min(cnt.values()) > 1 or len(l) < 9:
print('NO')
else:
print('YES')
脑筋急转弯。 重点就是这个判别 max(cnt.values()) - min(cnt.values()) > 1 or len(l) < 9

京公网安备 11010502036488号