n=int(input())
A=list(map(int,input().split()))

if set(A)=={0}:
  print('Yes')
elif A.count(A[0])==2*n/3 and A.count(0)==n/3:
  print('Yes')
elif len(set(A))==3:
  if A.count(list(set(A))[0])==n/3 and A.count(list(set(A))[1])==n/3 and A.count(list(set(A))[2])==n/3:
    print('Yes')
else:
  print('No')