N = int(input())
a = list(map(int, input().split()))

R = {}
for i in a:
  if i in R:
    R[i] += 1
  else:
    R[i] = 1

if len(R) != 3:
  print("No")
else:
  t = -1
  for i in R.values():
    if t == -1:
      t = i
    else:
      if i != t:
        print("No")
        break
  else:
    print("Yes")