const input = require("fs").readFileSync("/dev/stdin", "utf8");
// const input = `3
// 1 2 3`;

const lines = input.split('\n').filter(Boolean);
const N = +lines[0];
const numbers = lines[1].split(' ').filter(Boolean).map(Number).slice(0, N);

console.log(isValid() ? 'Yes' : 'No');

function isValid() {
  if (numbers.every((n) => n === 0)) {
    return true;
  }

  const unique = {};
  var count = 0;
  for (var i = 0, l = numbers.length; i < l; i+= 1) {
    var number = numbers[i];
    if (unique[number] == null) {
      count += 1;
      if (count > 3) {
        return false;
      }
      unique[number] = 0;
    }

    unique[number] += 1;
  }

  const counts = Object.keys(unique).map((key) => unique[key]);
  if (counts.length === 2 && unique[0] != null) {
    return counts[0] === counts[1] * 2 || counts[0] * 2 === counts[1];
  }

  if (counts.length === 3) {
    return counts[0] === counts[1] && counts[1] === counts[2];
  }

  return false;
}
