#include <bits/stdc++.h>
using namespace std;
const int maxn = 1003;
vector<int> g[maxn];
int n;
bool ans = 1;
bool dfs(int nod) {
  int aa = 0;
  for (auto x : g[nod]) {
    aa += dfs(x);
  }
  if (aa > 0 && aa < 3) ans = 0;
  if (aa == 0 && g[nod].size()) ans = 0;
  return (aa == 0);
}
int main() {
  if (0) {
    freopen("a.in", "r", stdin);
    freopen("a.out", "w", stdout);
  }
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int x;
    cin >> x;
    g[x].push_back(i + 1);
  }
  dfs(1);
  cout << ((ans == 1) ? "Yes" : "No");
  return 0;
}
