#include <bits/stdc++.h>
using namespace std;
const short DEBUG{0};
void solve() {
  int n;
  cin >> n;
  vector<vector<int>> g(n + 1);
  for (int i{1}; i <= n - 1; ++i) {
    int p;
    cin >> p;
    g[p].push_back(i + 1);
  }
  bool flag = 1;
  for (auto &l : g) {
    if (l.size() == 0) continue;
    if (l.size() < 3) {
      flag = 0;
      break;
    }
    int cnt = 0;
    for (auto &v : l)
      if (g[v].size() == 0) ++cnt;
    if (cnt < 3) {
      flag = 0;
      break;
    }
  }
  cout << (flag ? "Yes\n" : "No\n");
}
int main() {
  int t{1};
  while (t--) solve();
  return 0;
}
