#include <bits/stdc++.h>
using namespace std;
using VI = vector<int>;
using VVI = vector<VI>;
using PII = pair<int, int>;
using LL = long long;
using VL = vector<LL>;
using VVL = vector<VL>;
using PLL = pair<LL, LL>;
using VS = vector<string>;
template <class S, class T>
istream& operator>>(istream& is, pair<S, T>& p) {
  return is >> p.first >> p.second;
}
template <class T>
istream& operator>>(istream& is, vector<T>& xs) {
  for (auto& x : xs) is >> x;
  return is;
}
template <class S, class T>
ostream& operator<<(ostream& os, const pair<S, T>& p) {
  return os << p.first << " " << p.second;
}
template <class T>
void maxi(T& x, T y) {
  if (x < y) x = y;
}
template <class T>
void mini(T& x, T y) {
  if (x > y) x = y;
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const LL MOD = 1e9 + 7;
int leaf[1010];
bool dfs(VVI& G, int u, int p) {
  int cnt = 0, lf = 0;
  for (int to : G[u]) {
    if (to == p)
      continue;
    else {
      ++cnt;
      if (!dfs(G, to, u)) return false;
      lf += leaf[to];
    }
  }
  leaf[u] = cnt == 0;
  return leaf[u] || lf >= 3;
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N;
  cin >> N;
  VVI G(N);
  for (int i = (0); i < (N - 1); ++i) {
    int p;
    cin >> p;
    --p;
    G[i + 1].push_back(p);
    G[p].push_back(i + 1);
  }
  cout << (dfs(G, 0, -1) ? "Yes" : "No") << endl;
  return 0;
}
