#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1000000 + 342];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int x;
  for (int i = 2; i <= n; i++) {
    cin >> x;
    adj[x].push_back(i);
  }
  bool pos = true;
  for (int i = 1; i <= n; i++) {
    int count = 0;
    if (adj[i].size() > 0) {
      for (int j = 0; j < (int)adj[i].size(); j++) {
        if (adj[adj[i][j]].size() == 0) {
          count++;
        }
      }
      if (count < 3) {
        pos = false;
      }
    }
  }
  if (pos) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
  return 0;
}
