#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[100005];
bool visited[100005];
long long int temp = 0;
void dfs(long long int i, long long int parent) {
  if (!visited[i]) {
    visited[i] = true;
    long long int count = 0;
    vector<long long int>::iterator it;
    if (adj[i].size() == 1) {
      if (adj[i][0] != parent) temp = 1;
      return;
    }
    for (it = adj[i].begin(); it != adj[i].end(); it++) {
      if (*it != parent) {
        if (adj[*it].size() == 1) {
          if (adj[*it][0] == i) count += 1;
        }
      }
    }
    if (count < 3) {
      temp = 1;
      return;
    } else {
      for (it = adj[i].begin(); it != adj[i].end(); it++) {
        if (*it != parent) dfs(*it, i);
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, i, u, count = 0, j;
  cin >> n;
  vector<long long int>::iterator it;
  memset(visited, false, sizeof(visited));
  visited[1] = true;
  for (i = 2; i <= n; i++) {
    cin >> u;
    adj[i].push_back(u);
    adj[u].push_back(i);
  }
  for (it = adj[1].begin(); it != adj[1].end(); it++) {
    if (adj[*it].size() == 1) {
      if (adj[*it][0] == 1) count += 1;
    }
  }
  if (count < 3)
    cout << "No" << endl;
  else {
    for (it = adj[1].begin(); it != adj[1].end(); it++) dfs(*it, 1);
    if (temp == 1)
      cout << "No" << endl;
    else
      cout << "Yes" << endl;
  }
  return 0;
}
