#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  bool check = true;
  cin >> n;
  int* a = new int[n];
  int* count = new int[n];
  int* countleaf = new int[n];
  for (int i = 0; i < n; i++) {
    a[i] = 0;
    count[i] = 0;
    countleaf[i] = 0;
  }
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    a[i]--;
    count[a[i]]++;
  }
  for (int i = 0; i < n; i++) {
    if (count[i] == 0) countleaf[a[i]]++;
  }
  for (int j = 0; j < n; j++) {
    if (count[j] > 0 && countleaf[j] < 3) {
      check = false;
      break;
    }
  }
  delete count;
  delete a;
  delete countleaf;
  if (check)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
