#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> A[1001];
bool visited[1001];
void dfs(int s) {
  if (visited[s]) return;
  visited[s] = true;
  cout << s << " ";
  for (auto u : A[s]) dfs(u);
}
int main(int argv, char *argc[]) {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int use;
    cin >> use;
    A[use].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (auto j : A[i])
      if (A[j].empty()) cnt++;
    if (cnt < 3 && !A[i].empty()) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}
