#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long inf = 1e18;
long long m_inf = INT_MIN;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  std::cout.unsetf(std::ios::fixed);
  std::cout.precision(9);
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    vector<vector<long long> > adj(n);
    for (long long i = 1; i < n; i++) {
      long long x;
      cin >> x;
      x--;
      adj[x].push_back(i);
    }
    bool flag = true;
    for (long long i = 0; i < n; i++) {
      long long count = 0;
      if (!adj[i].size()) continue;
      for (long long j = 0; j < adj[i].size(); j++) {
        if (adj[adj[i][j]].size() == 0) count++;
      }
      if (count < 3) {
        flag = false;
        break;
      }
    }
    if (flag)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}
