a = int(input())
b = list(map(int, input().split()))
c = {}
for i in range(a):
    if b[i] not in c:
        c.setdefault(b[i], 1)
    else:
        c[b[i]] += 1
if len(c) != 3:
    print("No")
    exit()
else:
    for i in range(1, len(c)):
        f = list(c.values())
        if f[i] != f[i-1]:
            print("No")
            exit()
    print("Yes")
