#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using Pair = pair<int, int>;
using List = vector<int>;
using Edge = vector<int>;
using Graph = vector<Edge>;

Pair dfs(const int v, const Graph& to) {
  int res = 1, t = 1, a = 0, b = 0;
  List cs;
  for (int u : to[v]) {
    auto r = dfs(u, to);
    t ^= r.second;
    r.first *= -1;
    if (r.second) {
      cs.push_back(r.first);
    } else if (r.first >= 0) {
      a += r.first;
    } else {
      b += r.first;
    }
  }
  res -= a;
  sort(cs.rbegin(), cs.rend());
  for (int i = 0; i < (int)cs.size(); i++) {
    if (i & 1) {
      res += cs[i];
    } else {
      res -= cs[i];
    }
  }
  if (cs.size() & 1) {
    res += b;
  } else {
    res -= b;
  }
  return Pair(res, t);
}

int main() {
  int n;
  cin >> n;
  vector<vector<int>> to(n);
  for (int i = 1; i < n; i++) {
    int parent;
    cin >> parent;
    --parent;
    to[parent].push_back(i);
  }

  auto [v, NO_USE__] = dfs(0, to);
  int ans = (n + v) / 2;
  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define chmin(x,y) x = min((x),(y));
#define chmax(x,y) x = max((x),(y));
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
const int INF = 1e9;
const long long LINF = 1e18;
const int MOD = 1000000007;
//const int MOD = 998244353;
const double PI = 3.14159265358979323846;

int main(){
    int n;
    cin >> n;
    vector<int> p(n);
    rep(i,n-1) cin >> p[i+1];
    rep(i,n) --p[i];
    vector<vector<int>> tree(n);
    rep(i,n-1) tree[p[i+1]].push_back(i+1);
    vector<P> dp(n); //first second
    vector<int> sz(n);
    vector<int> seen(n,-1);
    auto dfs = [&](auto&& dfs,int i) -> pair<P,int>{
        if(seen[i] == 1) return {dp[i],sz[i]};
        seen[i] = 1;
        int f = 1;
        int s = 0;
        int sz_i = 1;
        vector<P> odd;
        vector<P> even;
        for(int j:tree[i]){
            pair<P,int> now = dfs(dfs,j);
            sz_i += now.second;
            if(now.second % 2 == 0){
                even.push_back(now.first);
            }else{
                odd.push_back(now.first);
            }
        }
        sort(odd.begin(),odd.end(),[](P l,P r){
            return l.second - l.first > r.second - r.first;
        });
        sort(even.begin(),even.end(),[](P l,P r){
            return l.second - l.first > r.second - r.first;
        });
        rep(j,even.size()){
            if(even[j].second - even[j].first > 0)s += even[j].second,f += even[j].first;
        }
        bool fi = true;
        rep(j,odd.size()){
            if(fi) s += odd[j].second, f += odd[j].first, fi = !fi;
            else   f += odd[j].second, s += odd[j].first, fi = !fi;
        }
        rep(j,even.size()){
            if(even[j].second - even[j].first <= 0){
                if(fi) s += even[j].second, f += even[j].first;
                else   f += even[j].second, s += even[j].first;
            }
        }
        dp[i] = {f,s};
        sz[i] = sz_i;
        return {dp[i],sz[i]};
    };
    cout << dfs(dfs,0).first.first << endl;
    return 0;
}