#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
vector<long long> v[((long long)(2e6 + 100))];
string s;
long long a[((long long)(2e6 + 100))];
bool go(long long x) {
  if (v[x].size() == 0) return 1;
  long long c = 0;
  bool e = 1;
  for (auto y : v[x]) {
    if (v[y].size() == 0) c++;
    e &= go(y);
  }
  e &= (c >= 3);
  return e;
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> k;
    v[k].push_back(i);
  }
  if (go(1))
    cout << "Yes";
  else
    cout << "No";
}
