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

memo = {}
for i in range(n):
    if a[i] not in memo:
        memo[a[i]] = 1
    else:
        memo[a[i]] += 1

if len(memo) == 1:
    tmp = [i for i in memo]
    if tmp[0] == 0:
        print("YES")
        exit()

if len(memo) == 2:
    tmp = [i for i in memo]
    if tmp[0] == 0:
        if memo[tmp[0]]*2 == memo[tmp[1]]:
            print("YES")
            exit()
    if tmp[1] == 0:
        if memo[tmp[1]]*2 == memo[tmp[0]]:
            print("YES")
            exit()
            
if len(memo) == 3:
    tmp = [i for i in memo]
    if memo[tmp[0]] == memo[tmp[1]] and memo[tmp[1]] == memo[tmp[2]]:
        print("YES")
        exit()

print("NO")