#!/usr/bin/env python3 # -*- coding: utf-8 -*- import collections def repeatedly_subtract(x, ls): assert x <= sum(ls) while x > 0: if x < ls[-1]: ls[-1] -= x break else: x -= ls[-1] _ = ls.pop() def solve(n, ornaments): counter = collections.Counter(ornaments) numbers = sorted(counter.values()) while numbers: max_n = numbers.pop() if max_n > sum(numbers) + 1: return False if not numbers: return True repeatedly_subtract(max_n - 1, numbers) def main(): n = int(input()) ornaments = [input() for _ in range(n)] if solve(n, ornaments): print("YES") else: print("NO") if __name__ == '__main__': main()