#include <bits/stdc++.h>
using namespace std;
int64_t aa[100005], ss[10001], pp[1008];
char b[100005];
int main() {
  ios::sync_with_stdio(false);
  int64_t a, b, c = 1, d, e, f;
  cin >> a;
  for (int i = 2; i <= a; i++) cin >> aa[i];
  for (int i = a; i > 1; i--) {
    pp[aa[i]]++;
    if (!pp[i]) ss[i]--;
    if (ss[i] == -1) ss[aa[i]]++;
  }
  for (int i = 1; i <= a; i++)
    if (!(ss[i] == -1 || ss[i] >= 3)) {
      cout << "No";
      return 0;
    }
  cout << "Yes"
       << " ";
}
