void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n; rd(n);
  auto par=new int[](n);
  par[0]=-1;
  foreach(int i; 1..n){
    int p; rd(p);
    par[i]=(p-1);
  }

  auto leaf=new bool[](n);
  foreach(i; 0..n){
    auto c=count(par, i);
    if(c==0) leaf[i]=true;
  }
  foreach(i; 0..n)if(leaf[i]==false){
    int c=0;
    foreach(j; 0..n){
      if(par[j]==i && leaf[j]) c++;
    }
    if(c<3){writeln("No"); return;}
  }
  writeln("Yes");
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) write(e, " ");
  writeln();
}