#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1234];
int parent[1234];
int visited[1234];
int main() {
  int n;
  cin >> n;
  int number;
  queue<int> qq;
  for (int i = 2; i <= n; i++) {
    cin >> number;
    parent[number] = 1;
    adj[number].push_back(i);
  }
  qq.push(1);
  while (!qq.empty()) {
    int q = qq.front();
    qq.pop();
    int cnt = 0;
    for (int i = 0; i < adj[q].size(); i++) {
      int a = adj[q][i];
      if (!parent[a])
        cnt++;
      else
        qq.push(a);
    }
    if (cnt < 3) {
      printf("No");
      return 0;
    }
  }
  printf("Yes\n");
}
