n = int(input())
a = map(int, input().split())

import collections
c = collections.Counter(a)

v = []
for k in c.keys():
    v.append(c[k])
v.sort()

flag = False
if n % 3 == 0:
    if v == [n // 3, n // 3, n // 3] or v == [n] or v == [n // 3, n // 3 * 2]:
        flag = True
else:
    if v == [n]:
        flag = True

if flag:
    print('Yes')
else:
    print('No')
