#include <bits/stdc++.h>
using namespace std;
vector<int> graph[1001];
bool BFS(int source) {
  int visited[1001];
  queue<int> Q;
  memset(visited, 0, sizeof(visited));
  Q.push(source);
  visited[source] = 1;
  while (!Q.empty()) {
    int u = Q.front();
    Q.pop();
    if (graph[u].size() == 0) continue;
    int nonleaf = 0;
    for (int i = 0; i < graph[u].size(); i++) {
      int v = graph[u][i];
      if (visited[v] == 0) {
        visited[v] = 1;
        Q.push(v);
        if (graph[v].size() == 0) nonleaf++;
      }
    }
    if (nonleaf < 3) return 0;
  }
  return 1;
}
int main() {
  int N;
  cin >> N;
  int x;
  for (int i = 2; i <= N; i++) {
    cin >> x;
    graph[x].push_back(i);
  }
  bool ans = BFS(1);
  if (ans == true)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
