#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int> > tree(n + 1, vector<int>(3, 0));
  for (int i = 2; i < n + 1; i++) {
    cin >> tree[i][0];
    if (tree[tree[i][0]][1] + tree[tree[i][0]][2] == 0) {
      tree[tree[tree[i][0]][0]][2] += 1;
      tree[tree[tree[i][0]][0]][1] -= 1;
    }
    tree[tree[i][0]][1] += 1;
  }
  for (int i = 1; i < n + 1; i++) {
    if (!(tree[i][1] == 0 && tree[i][2] == 0) && tree[i][1] < 3) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
