#!/usr/bin/env python3
from collections import Counter
# from numba import njit

# input = stdin.readline

# @njit
def solve(n,a):
  d = Counter(a)

  if d[0] == n:
    return True
  if len(d) == 2 and d[0] == n // 3:
    return True
  if len(d) == 3 and all(value == n // 3 for value in d.values()):
    return True
  return False





def main():
  N = int(input())
  # N,M = map(int,input().split())
  a = list(map(int,input().split()))
  print("Yes" if solve(N,a) else "No")
  return

if __name__ == '__main__':
  main()
