#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unordered_map<int, vector<int>> m;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    m[x].push_back(i);
  }
  int flag = 0;
  for (int i = 1; i <= n; i++) {
    if (m[i].size() != 0) {
      int nullcount = 0;
      for (int j = 0; j < m[i].size(); j++) {
        if (m[m[i][j]].size() == 0) {
          nullcount++;
        }
      }
      if (nullcount < 3) {
        flag = 1;
        break;
      }
    }
  }
  if (flag == 1)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}
