#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 10, MAX = 2e5 + 1e4, MOD = 1e9 + 7, MAXL = 25;
void OUT(long double o, int x) {
  cout << fixed << setprecision(x) << o;
  return;
}
long long a[MAX], t = 1;
vector<int> adj[MAX];
void dfs(int v, int p) {
  long long c = 0;
  for (int u : adj[v]) {
    if (u != p) {
      dfs(u, v);
      if (adj[u].size() == 1) c++;
    }
  }
  if (adj[v].size() > 1 && c < 3) t = 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    long long x;
    cin >> x;
    adj[x].push_back(i);
    adj[i].push_back(x);
  }
  dfs(1, 1);
  if (t)
    cout << "Yes";
  else
    cout << "No";
  return 0;
}
