#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int> > vec(n + 1);
  for (int i = 2, foo; i <= n; i++) cin >> foo, vec[foo].push_back(i);
  queue<int> q;
  q.push(1);
  while (!q.empty()) {
    int curr = q.front(), cnt = 0;
    q.pop();
    if (vec[curr].empty()) continue;
    for (int i = 0; i < vec[curr].size(); i++) {
      int child = vec[curr][i];
      if (curr == child) continue;
      q.push(child), cnt += (vec[child].empty());
    }
    if (cnt > 2) continue;
    puts("No");
    return 0;
  }
  puts("Yes");
}
