from collections import Counter

# s = input()
N = int(input())
A = list(map(int, input().split()))
# a, b = map(int, input().split())

c = Counter()

for a in A:
    c[a] += 1

if len(c.keys()) == 1:
    print("Yes")
    exit()

v = list(c.values())
if len(v) == 3:
    if v[0] == v[1] and v[1] == v[2]:
        print("Yes")
        exit()

print("No")


