import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

bool calc(int[] a) {
    if (a.all!"a == 0") return true;

    int[int] d;
    foreach (e; a) d[e]++;

    if (a.length % 3 == 0) {
        auto values = d.values;
        if (values.length % 3 == 0 && values[0] == values[1] && values[1] == values[2])
            return true;
    }
    return false;
}

void main() {
    readint;
    auto a = readints;
    writeln(calc(a) ? "Yes" : "No");
}
