from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
if set(a) == {0}:
    print('Yes')
    exit()

flag = 0
if n % 3 == 0:
    if len(cnt) == 2:
        if cnt[0] == n // 3:flag = 1
    elif len(cnt) == 3:
        if len(cnt.values()) == 1:flag = 1

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