#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> g[1010];
bool leaf[1010], valid[1010];
int lch[1010];
void dfs(int x, int p) {
  int chi = 0;
  for (int ch : g[x]) {
    if (ch == p) continue;
    chi++;
    dfs(ch, x);
    if (leaf[ch]) lch[x]++;
  }
  if (chi == 0)
    leaf[x] = true;
  else if (lch[x] >= 3)
    valid[x] = true;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    g[i].push_back(x);
    g[x].push_back(i);
  }
  dfs(1, 0);
  bool w = true;
  for (int i = 1; i <= n; i++) {
    if (!leaf[i] && lch[i] < 3) w = false;
  }
  if (w)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
