#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000;
vector<int> adj[MAX_N];
void dfs(int u) {
  int x = 0;
  for (auto i : adj[u]) {
    if (adj[i].empty())
      x++;
    else
      dfs(i);
  }
  if (x < 3) {
    cout << "No\n";
    exit(0);
  }
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u;
    cin >> u;
    u--;
    adj[u].push_back(i);
  }
  dfs(0);
  cout << "Yes\n";
  return 0;
}
