#include <bits/stdc++.h>
using namespace std;
vector<int> v[112345];
int main() {
  int n, t, i, j, x;
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> x;
    v[x].push_back(i + 1);
  }
  vector<int> leaves;
  for (int i = 1; i <= n; i++) {
    if (v[i].size() == 0) leaves.push_back(i);
  }
  int cnt;
  for (int i = 1; i <= n; i++) {
    if (v[i].size() != 0) {
      cnt = 0;
      for (int j = 0; j < v[i].size(); j++) {
        if (binary_search(leaves.begin(), leaves.end(), v[i][j])) cnt++;
      }
      if (cnt < 3) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}
