#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 3;
const int M = 1e7 + 7;
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 9;
const int SM = 1e3 + 5;
const int logN = 20, BL = 400;
const double EPS = 3e-16;
const int dx[] = {1, 0, 0, -1, -1, 1, -1, 1};
const int dy[] = {0, 1, -1, 0, -1, 1, 1, -1};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> p(n + 1), deg(n + 1), v(n + 1);
  for (long long i = 2; i <= n; i++) {
    cin >> p[i];
    deg[p[i]]++;
  }
  for (long long i = 1; i <= n; i++) {
    if (!deg[i]) {
      v[p[i]]++;
    }
  }
  for (long long i = 1; i <= n; i++) {
    if (deg[i] > 0 && v[i] < 3) return cout << "No", 0;
  }
  cout << "Yes";
  return 0;
}
