#include <bits/stdc++.h>
using namespace std;
int p[1000];
bool b[1000];
int a[1000];
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> p[i];
  }
  for (int i = n; i > 0; i--) {
    b[p[i]] = true;
    if (b[i]) {
      if (a[i] < 3) {
        cout << "No";
        return 0;
      }
    } else {
      a[p[i]]++;
    }
  }
  cout << "Yes";
  return 0;
}
