#include <bits/stdc++.h>
using namespace std;
using ld = long double;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, e, i;
  cin >> n;
  set<int> s;
  vector<int> a(n + 1, 0);
  map<int, int> mp;
  for (i = 2; i < n + 1; ++i) {
    cin >> e;
    mp[e]++;
    a[i] = e;
    s.insert(e);
  }
  for (int i : s) {
    mp[a[i]] -= 1;
  }
  for (i = 1; i < n + 1; ++i) {
    if ((mp.count(i) > 0) and (mp[i] < 3)) {
      cout << "No"
           << "\n";
      return 0;
    }
  }
  cout << "Yes"
       << "\n";
  return 0;
}
