#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 87;
int n, dp[N], sz[N];
vector<int> g[N];
void dfs(int u)
{
    sz[u] = 1;
    multiset<int> pq[2];
    for (int v : g[u]) {
        dfs(v);
        sz[u] += sz[v];
        pq[sz[v] % 2].insert(dp[v]);
    }
    dp[u] = 1;
    int cur = -1;
    while (pq[0].size() && *begin(pq[0]) < 0) {
        dp[u] += *begin(pq[0]);
        pq[0].erase(begin(pq[0]));
    }
    while (pq[1].size()) {
        if (cur == -1) {
            dp[u] += *begin(pq[1]);
            pq[1].erase(begin(pq[1]));
        } else {
            dp[u] -= *begin(pq[1]);
            pq[1].erase(begin(pq[1]));
        }
        cur *= -1;
    }
    while (pq[0].size()) {
        if (cur == -1) {
            dp[u] += *begin(pq[0]);
            pq[0].erase(begin(pq[0]));
        } else {
            dp[u] -= *begin(pq[0]);
            pq[0].erase(begin(pq[0]));
        }
    }
}
int main()
{
    cin >> n;
    for (int i = 2; i <= n; ++i) {
        int p;
        cin >> p;
        g[p].push_back(i);
    }
    dfs(1);
    cout << (dp[1] + n) / 2 << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000010
#define EPS 1e-9
#define F first
#define S second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"

typedef pair<int,int> PII;
typedef pair<int,string> PIS;
typedef pair<string,int> PSI;

int n;
int p[100000];
vector<int> v[100000];
pair<int,PII> score[100000];
bool vis[100000];

pair<int,PII> dfs(int st){
  // cout<<st<<endl;
  if(v[st].size() == 0){
    return score[st];
  }
  vector<pair<int,PII> > now,evenpos,evenneg;
  rep(i,v[st].size() ){
    pair<int,PII> pp=dfs(v[st][i]);
    //cout<<pp.F<<" ("<<pp.S.F<<" "<<pp.S.S<<")"<<endl;
    if(  (pp.S.F+pp.S.S) % 2 == 0){
      if(pp.F>0) evenpos.push_back(pp);
      else evenneg.push_back(pp);
    }else{
      now.push_back(pp);
    }
  }
  sort(now.begin(),now.end() );
  pair<int,PII> ret;
  ret=make_pair((int)0,make_pair((int)0,(int)0) );
  rep(i,evenneg.size() ){
    ret.S.F+=evenneg[i].S.F;
    ret.S.S+=evenneg[i].S.S;
  }
  if(now.size() != 0){
    rep(i,now.size()) {
      if(i%2==0){
	ret.S.F+=now[i].S.F;
	ret.S.S+=now[i].S.S;
      }else{
	ret.S.F+=now[i].S.S;
	ret.S.S+=now[i].S.F;
      }
    }
  }
  rep(i,evenpos.size() ){
    if(now.size() % 2 == 0){
      ret.S.F+=evenpos[i].S.F;
      ret.S.S+=evenpos[i].S.S;
    }else{
      ret.S.F+=evenpos[i].S.S;
      ret.S.S+=evenpos[i].S.F;
    }
  }
  ret.F=ret.S.F-ret.S.S;
  ret.F+=1;
  ret.S.F++;
  return ret;
}
      
		     

signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  
  cin>>n;
  rep(i,n-1){
    cin>>p[i];
    p[i]--;
    v[p[i]].push_back(i+1);
  }
  rep(i,n) score[i]=make_pair((int)1,make_pair((int)1,(int)0));
  
  rep(i,n) vis[i]=false;
  
  int st=0;
  pair<int,PII> ans=dfs(st);
  cout<<ans.S.F<<endl;
  

  return 0;
}
