#include <bits/stdc++.h>
using namespace std;
void dfs(int v, bool& ans, vector<vector<int>>& edges);
int main() {
  int n, x;
  cin >> n;
  vector<vector<int>> edges(n);
  for (int i = 0; i < n - 1; i++) {
    cin >> x;
    edges[x - 1].push_back(i + 1);
  }
  bool ans(true);
  dfs(0, ans, edges);
  if (ans)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
void dfs(int v, bool& ans, vector<vector<int>>& edges) {
  int leafs(0);
  for (int i : edges[v]) {
    if (edges[i].size() == 0) {
      leafs++;
    } else
      dfs(i, ans, edges);
  }
  if (leafs < 3 && edges[v].size() > 0) ans = false;
}
