#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  signed long long n;
  cin >> n;
  signed long long p[1006];
  signed long long l[1006] = {0};
  signed long long vis[1006] = {0};
  memset(p, -1, sizeof(p));
  vis[1] = 1;
  for (signed long long i = 2; i <= n; i++) {
    cin >> p[i];
    l[p[i]]++;
    if (p[p[i]] != -1 && vis[p[i]] == 0) l[p[p[i]]]--;
    vis[p[i]] = 1;
  }
  for (signed long long i = 1; i <= n; i++) {
    if ((vis[i] == 1 && l[i] < 3)) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  return 0;
}
