#include <bits/stdc++.h>
using namespace std;
typedef struct graph {
  int v;
  list<int> *adj;
} graph;
graph *creategraph() {
  graph *gra = new graph;
  cin >> gra->v;
  gra->v++;
  gra->adj = new list<int>[gra->v];
  return gra;
}
void addedge(graph *gra, int u, int v) { gra->adj[u].push_back(v); }
bool bfs(graph *gra) {
  list<int> queue;
  queue.push_back(1);
  int s;
  list<int>::iterator itr;
  while (!queue.empty()) {
    int count = 0;
    s = queue.front();
    queue.pop_front();
    for (itr = gra->adj[s].begin(); itr != gra->adj[s].end(); itr++) {
      if (gra->adj[*itr].empty()) {
        count++;
        continue;
      } else
        queue.push_back(*itr);
    }
    if (count < 3) return false;
  }
  return true;
}
int main() {
  graph *gra = creategraph();
  int i, u;
  for (i = 2; i < gra->v; i++) {
    cin >> u;
    addedge(gra, u, i);
  }
  if (bfs(gra))
    cout << "Yes";
  else
    cout << "No";
}
