from algorithm import nextPermutation

# ソート済みのを渡さないと全パターン列挙はしてくれない (途中から列挙も可能にするための仕様)
iterator permutations*[T](a: seq[T]): seq[T] =
  var p = a
  yield p
  while p.nextPermutation:
    yield p

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
import tables
from strutils import split, parseInt
from sequtils import map, mapIt, allIt
from algorithm import sorted

let
  N = stdin.readLine.parseInt
  a = stdin.readLine.split.map(parseInt)

var ct = initCountTable[int]()
for v in a:
  ct.inc(v)

proc isOK(): bool =
  (ct.len == 1 and ct.hasKey(0)) or (
    N mod 3 == 0 and
    (ct.len == 2 and ct.hasKey(0) and ct.largest.key != 0 and ct[0] == N div 3) or
    (ct.len == 3 and ct.largest.val == ct.smallest.val)
  )

if isOK():
  echo "Yes"
else:
  echo "No"
