from collections import Counter

N = int(input())
A = list(map(int,input().split()))

def solve():
    counts = sorted(Counter(A).values())
    if N % 3 == 0:
        if len(counts) == 1:
            return True
        elif len(counts) == 2:
            return counts[0] == counts[1]*2
        elif len(counts) == 3:
            return counts[0] == counts[2]
        else:
            return False
    else:
        return len(counts) == 1

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