#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> a, b, c;
  for (int i = 1; i < n; i++) cin >> a[i + 1], b[a[i + 1]]++;
  for (int i = 1; i <= n; i++)
    if (!b[i]) c[a[i]]++;
  for (int i = 1; i <= n; i++)
    if (b[i] && c[i] < 3) {
      cout << "No" << endl;
      return 0;
    }
  cout << "Yes";
  return 0;
}
