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