/* imports all std modules {{{*/
import
  std.algorithm,
  std.array,
  std.ascii,
  std.base64,
  std.bigint,
  std.bitmanip,
  std.compiler,
  std.complex,
  std.concurrency,
  std.container,
  std.conv,
  std.csv,
  std.datetime,
  std.demangle,
  std.encoding,
  std.exception,
  std.file,
  std.format,
  std.functional,
  std.getopt,
  std.json,
  std.math,
  std.mathspecial,
  std.meta,
  std.mmfile,
  std.net.curl,
  std.net.isemail,
  std.numeric,
  std.parallelism,
  std.path,
  std.process,
  std.random,
  std.range,
  std.regex,
  std.signals,
  std.socket,
  std.stdint,
  std.stdio,
  std.string,
  std.system,
  std.traits,
  std.typecons,
  std.uni,
  std.uri,
  std.utf,
  std.uuid,
  std.variant,
  std.zip,
  std.zlib;
/*}}}*/

/+---test
3
1 2 3
---+/
/+---test
4
1 2 4 8
---+/

void main(string[] args) {
  const N = readln.chomp.to!long;
  const A = readln.split.map!(to!long).array.sort.array;

  const w  = 0;
  const wn = A.countUntil!(i => i != w);
  if (wn < 0) {
    "Yes".writeln;
    return;
  }

  const x  = A[wn];
  const xn = A[wn..$].countUntil!(i => i != x);
  if (xn < 0) {
    (xn*2 == wn? "Yes": "No").writeln;
    return;
  }

  const y  = A[xn+wn];
  const yn = A[xn+wn..$].countUntil!(i => i != y);
  if (yn < 0) {
    "No".writeln;
    return;
  }

  const z  = A[yn+xn+wn];
  const zn = A.length - yn - xn - wn;

  ((wn == 0 && xn == yn && yn == zn)? "Yes": "No").writeln;
}
