#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > graph;
bool dfs(int i) {
  int num = 0;
  for (auto &e : graph[i])
    if (graph[e].size() == 0)
      num++;
    else {
      if (!dfs(e)) return false;
    }
  return num >= 3;
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  graph.resize(n);
  for (int i = 0; i < n - 1; ++i) {
    int tmp;
    cin >> tmp;
    graph[tmp - 1].push_back(i + 1);
  }
  cout << (dfs(0) ? "Yes" : "No") << endl;
  return 0;
}
