#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> Tree[n + 1];
  for (int i = 1; i < n; ++i) {
    int x;
    cin >> x;
    Tree[x].push_back(i + 1);
  }
  bool flag = true;
  for (vector<int> u : Tree) {
    if (u.size() < 3 && u.size() != 0) {
      flag = false;
      break;
    } else if (u.size() >= 3) {
      int num = 0;
      for (int x : u) {
        if (Tree[x].size() == 0) ++num;
      }
      if (num < 3) {
        flag = false;
        break;
      }
    }
  }
  if (flag)
    cout << "Yes\n";
  else
    cout << "No\n";
}
