#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int a[maxn], vis[maxn];
int main() {
  int n, x, i;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &a[i]);
    vis[a[i]] = 1;
  }
  for (int i = n; i >= 1; i--)
    if (!vis[i]) vis[a[i]]++;
  for (i = 1; i <= n; i++)
    if (vis[i] && vis[i] < 4) break;
  if (i > n)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
