#include <bits/stdc++.h>
using namespace std;
map<long long int, vector<long long int>> t;
int main() {
  long long int n;
  cin >> n;
  map<long long int, long long int> deg;
  map<long long int, long long int> p;
  for (long long int i = 1; i <= n - 1; i++) {
    long long int temp;
    cin >> temp;
    deg[temp]++;
    p[i + 1] = temp;
  }
  map<long long int, long long int> v;
  for (long long int i = 1; i <= n; i++) {
    if (deg[i] == 0) v[p[i]]++;
  }
  long long int flag = 1;
  for (long long int i = 1; i <= n; i++) {
    if (v[i] < 3 && deg[i] != 0) {
      flag = 0;
      break;
    }
  }
  if (flag)
    cout << "Yes\n";
  else
    cout << "No\n";
}
