#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > V(1002);
int COUNT(int i);
int SEL(int i);
int main() {
  int n, i, j;
  vector<int> dist;
  cin >> n;
  for (i = 1; i <= n; i++) {
    V[i].push_back(0);
  }
  int temp;
  for (i = 0; i < n - 1; i++) {
    cin >> temp;
    if (V[temp].size() == 1) {
      dist.push_back(temp);
    }
    V[temp].push_back(i + 2);
  }
  int count;
  for (j = 0; j < dist.size(); j++) {
    i = dist[j];
    count = COUNT(i);
    if (count == 0) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
int COUNT(int i) {
  int j, temp, count = 0;
  for (j = 1; j < V[i].size(); j++) {
    temp = V[i][j];
    if (V[temp].size() == 1) {
      count++;
    }
    if (count == 3) {
      return 1;
    }
  }
  return 0;
}
