/**
 *    author:  shishunze
 *    date:	 2021/2/18
**/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back

const int N = 100005;
vector<int> e[N];
int n,x,dp[N],sz[N];
void dfs1(int u)
{
	sz[u]=1;
	for(int i=0;i<e[u].size();i++)
	{
		int v  = e[u][i];
		dfs1(v);
		sz[u]+=sz[v];
	}
}
void dfs2(int u)
{
	vector<int> vt;
	int sum=0;
	dp[u]=1;
	for(int i=0;i<e[u].size();i++)
	{
		int v = e[u][i];
		dfs2(v);
		
		if(sz[v]%2==0 && dp[v]<0) dp[u]+=dp[v];
		if(sz[v]%2==1) vt.pb(dp[v]);
		if(sz[v]%2==0 && dp[v]>=0) sum+=dp[v];
	}
	sort(vt.begin(),vt.end());
	vt.pb(sum);
	for(int i=0;i<vt.size();i++)
	{
		if(i%2==0) dp[u]+=vt[i];
		else dp[u]-=vt[i];
	}
}
int main()
{
	ios::sync_with_stdio(false);
	
	cin>>n;
	for(int i=2;i<=n;i++)
	{
		cin>>x;
		e[x].pb(i);
	}
	dfs1(1);
	dfs2(1);
	cout<<(n+dp[1])/2;
}




























#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

vector<int> v[100000];

pair<int, pair<int, int>> dfs(int x) {
    int p1 = 0, p2 = 0, sa = 0, sb = 0, f = 0, i;
    vector<pair<int, pair<int, int>>> w;
    
    p1++;
    f = 1 - f;
    
    for (i = 0; i < v[x].size(); i++) {
        pair<int, pair<int, int>> p = dfs(v[x][i]);
        int x = p.second.first;
        int y = p.second.second;
        
        if (p.first == 0) {
            if (x <= y) {
                p1 += x;
                p2 += y;
            } else {
                sa += x;
                sb += y;
            }
        } else {
            w.push_back(make_pair(x - y, make_pair(x, y)));
        }
    }
    
    sort(w.begin(), w.end());
    
    for (i = 0; i < w.size(); i++) {
        int x = w[i].second.first;
        int y = w[i].second.second;
        
        if (f == 1) {
            p1 += x;
            p2 += y;
        } else {
            p1 += y;
            p2 += x;
        }
        
        f = 1 - f;
    }
    
    if (f == 1) {
        p1 += sa;
        p2 += sb;
    } else {
        p1 += sb;
        p2 += sa;
    }
    
    return make_pair(f, make_pair(p1, p2));
}

int main() {
    int n, i;
    
    scanf("%d", &n);
    
    for (i = 1; i < n; i++) {
        int p;
        
        scanf("%d", &p);
        
        v[p - 1].push_back(i);
    }
    
    printf("%d\n", dfs(0).second.first);
    
    return 0;
}
