#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<vector<int> > v;
  cin >> n;
  v.resize(n);
  for (int i = 1, x; i < n; ++i) {
    cin >> x;
    v[--x].push_back(i);
  }
  for (int i = 0, total; i < n; ++i) {
    total = 0;
    if (v[i].empty()) continue;
    for (int j = 0; j < v[i].size(); ++j)
      if (v[v[i][j]].empty()) ++total;
    if (total < 3) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}
