#include <bits/stdc++.h>
using namespace std;
int a[1001];
int idx[1001] = {0};
int is_leaf[1001] = {0};
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    a[i]--;
    is_leaf[a[i]]++;
  }
  n--;
  for (int i = 1; i <= n; i++) {
    if (is_leaf[i] == 0) idx[a[i]]++;
  }
  for (int i = 0; i <= n; i++)
    if (idx[i] >= 3 || is_leaf[i] == 0)
      continue;
    else {
      cout << "No";
      return 0;
    }
  cout << "Yes";
  return 0;
}
