n = int(input())
a = [int(_) for _ in input().split(' ')]

if n % 3 == 0:
    a.sort()
    m = n // 3
    if a[0] == a[m - 1] and a[m] == a[2 * m - 1] and a[2 * m] == a[3 * m - 1]:
        print('Yes')
    else:
        print('No')
else:
    if max(a) == min(a):
        print('Yes')
    else:
        print('No')
