import sys
from itertools import groupby as gb
from itertools import permutations as perm
from itertools import combinations as comb
from collections import Counter as C
from collections import defaultdict as dd
sys.setrecursionlimit(10**5)
def y(f):
    if f:
        print('Yes')
    else:
        print('No')
def Y(f):
    if f:
        print('YES')
    else:
        print('NO')



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

if all((i == 0) for i in a):
    print('Yes')
    exit()

p = n // 3
if n % 3 != 0:
    print('No')
    exit()

if 0 in a:
    a = sorted(a)
    zero = a.count(0)
    if zero != p:
        print('No')
        exit()
    g = gb(a)
    for k, v in g:
        if k == 0:
            continue
        if len(list(v)) % 2 != 0:
            print('No')
            exit()
    print('Yes')
    exit()
    # if a[p] != a[-1]:
    #     print('No')
    #     exit()
    # print('Yes')
    # exit()

a = sorted(a)
if a.count(a[0]) != p or a.count(a[p]) != p or a.count(a[-1]) != p:
    print('No')
else:
    if a[0] == a[p] or a[p] == a[-1] or a[-1] == a[0]:
        print('No')
    else:
        print('Yes')
