import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;

    if (N % 3 != 0 && A.map!(a => a == 0).all) {
        writeln("No");
        return;
    }

    int[long] count;
    foreach (a; A) count[a] += 1;

    if (count.values.map!(a => a % (N / 3) == 0).all) {
        writeln("Yes");
    } else {
        writeln("No");
    }
}