from collections import Counter
def solve():
    N = int(input())
    A = list(map(int,input().split()))
    counter = Counter(A)

    if len(counter.keys()) == 1:
        print('Yes')
    elif len(counter.keys()) == 2:
        if set(counter.values()) == {N//3,(2*N)//3}:
            print('Yes')
        else:
            print('No')

    elif len(counter.keys()) == 3:
        for _,val in counter.items():
            if val != N // 3:
                print('No')
                return
        else:
            print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    solve()