#include <bits/stdc++.h>
using namespace std;
int n, p, cnt, head[1010], vet[1010], Next[1010], size[1010], sum[1010];
inline void add_edge(int u, int v) {
  vet[++cnt] = v;
  Next[cnt] = head[u];
  head[u] = cnt;
}
void dfs(int u) {
  size[u] = 1;
  if (!head[u]) return;
  for (int i = head[u]; i; i = Next[i]) {
    int v = vet[i];
    dfs(v);
    if (size[v] == 1) sum[u]++;
    size[u] += size[v];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &p);
    add_edge(p, i);
  }
  dfs(1);
  for (int i = 1; i <= n; i++)
    if (size[i] > 1)
      if (sum[i] < 3) {
        puts("No");
        return 0;
      }
  puts("Yes");
  return 0;
}
