#include <bits/stdc++.h>
using namespace std;
int arr[1005], areleaf[1005];
bool vis[1005];
vector<int> v[1005];
bool poss = true;
int dfs(int u) {
  int leaf = 0;
  bool flag = false;
  vis[u] = true;
  for (int i = 0; i < v[u].size(); i++) {
    if (!vis[v[u][i]]) {
      flag = true;
      leaf += dfs(v[u][i]);
    }
  }
  if (!flag) {
    areleaf[u] = 1;
    return 1;
  } else {
    arr[u] = leaf;
    return 0;
  }
}
int main() {
  int n, x;
  (scanf("%d", &n));
  for (int i = 1; i <= n - 1; i++) {
    (scanf("%d", &x));
    v[x].push_back(i + 1);
    v[i + 1].push_back(x);
  }
  memset(vis, false, sizeof(vis));
  memset(areleaf, 0, sizeof(areleaf));
  dfs(1);
  for (int i = 1; i <= n; i++) {
    if (areleaf[i] == 0) {
      if (arr[i] < 3) {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes";
}
