import collections

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

# if n%3 != 0:
#     ans = sum(a_list)
#     if ans == 0:
#         print("Yes")
#     else:
#         print("No")
#     exit()


c = collections.Counter(a_list)
c_set = set(a_list)
check = -1

if len(c) == 1:
    if c[0] != 0:
        print("Yes")
        exit()
elif len(c) == 2:
    if c[0] == n//3:
        print("Yes")
        exit()
elif len(c) == 3:
    for i in c_set:
        if check == -1:
            check = c[i]
        else:
            if check != c[i]:
                print("No")
                exit()
    else:
        print("Yes")
        exit()
        
print("No")