from collections import defaultdict

N = int(input())
A = [int(i) for i in input().split()]
flag = True
if N%3==0:
  d = defaultdict(int)
  if len(set(A)) == 3:
    for i in range(N):
      d[A[i]] += 1
    for i, j in d.items(): 
      if j != N//3:
        flag = False
        
  elif len(set(A)) == 2:
    for i in range(N):
      d[A[i]] += 1
    for i, j in d.items():
      if i != 0 and j != 2*N//3:
        flag = False
      elif i==0 and j != N//3:
        flag = False
else:
  if list(set(A))[0]!=0 and len(set(A))!=1:
    flag = False
  
print("Yes" if flag else "No")