#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, vector<int> > m;
  int e;
  for (int i = 2; i <= n; i++) {
    cin >> e;
    m[e].push_back(i);
  }
  vector<bool> leaf(n + 1, true);
  leaf[1] = false;
  for (int i = 1; i <= n; i++) {
    if (m.count(i) > 0) {
      int c = 0;
      for (auto it = m[i].begin(); it != m[i].end(); it++) {
        if (m.count(*it) != 1) c++;
      }
      if (c < 3) {
        cout << "No\n";
        return 0;
      }
    }
  }
  cout << "Yes\n";
}
