from collections import Counter

def solve(N, As):
    c = Counter(As)
    if len(c) == 1:
        return "Yes"
    if len(c) == 3 and c[0] == c[1] == c[2]:
        return "Yes"
    return "No"


if __name__ == "__main__":
    N = int(input())
    As = list(map(int, input().split(" ")))
    print(solve(N, As))
