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.datetime;

void main() {
    auto N = readln.chomp.to!int;
    auto G = new int[][](N);
    foreach (i; 0..N-1) {
        auto v = readln.chomp.to!int;
        G[v-1] ~= i+1;
    }

    auto is_leaf = new bool[](N);
    foreach (i; 0..N) is_leaf[i] = G[i].length == 0;

    auto ok = new bool[](N);
    foreach (i; 0..N) {
        if (is_leaf[i]) {
            ok[i] = true;
            continue;
        }
        int cnt = 0;
        foreach (m; G[i]) {
            cnt += is_leaf[m];
        }
        ok[i] = cnt >= 3;
    }

    writeln(ok.all ? "Yes" : "No");
}
