#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<vector<int> > vv;
vector<bool> visited;
vector<int> leaf;
void dfsfs(int f, int s) {
  if (visited[s]) {
    return;
  }
  visited[s] = true;
  if (vv[s].size() == 0) {
    leaf[f]++;
  }
  for (auto u : vv[s]) {
    dfsfs(s, u);
  }
}
int main() {
  cin >> n;
  vv.resize(n);
  visited.resize(n);
  leaf.resize(n);
  for (int i = 1; i < n; i++) {
    cin >> m;
    m--;
    vv[m].push_back(i);
  }
  dfsfs(0, 0);
  for (int i = 0; i < n; i++) {
    if (vv[i].size() == 0 || leaf[i] >= 3) {
      continue;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}
