#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int *p = new long long int[n];
  long long int *count = new long long int[n];
  vector<long long int> *child = new vector<long long int>[n];
  for (long long int i = 0; i < n; i++) {
    count[i] = 0;
  }
  p[0] = -1;
  for (long long int i = 1; i < n; i++) {
    cin >> p[i];
    p[i]--;
    count[p[i]]++;
    child[p[i]].push_back(i);
  }
  for (long long int i = 0; i < n; i++) {
    if (count[i] != 0) {
      if (count[i] < 3) {
        cout << "No" << endl;
        return 0;
      }
      long long int temp = 0;
      for (long long int j = 0; j < count[i]; j++) {
        if (count[child[i][j]] == 0) {
          temp++;
        }
      }
      if (temp < 3) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}
