#include<bits/stdc++.h>
using namespace std;
int read() {
	char c=getchar(); int x=0,f=1;
	while (c<'0' || c>'9') {
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
vector<pair<int,int> > odd[100005],even[100005];
vector<int> G[100005];
int a[100005],b[100005],siz[100005];
bool cmp(pair<int,int> x,pair<int,int> y) {
	int dx=x.first-x.second;
	int dy=y.first-y.second;
	return dx>dy;
}
void dfs(int x) {
	siz[x]=1;
	for (int i=0; i<G[x].size(); i++) {
		int v=G[x][i];
		dfs(v);
		if (siz[v]&1) odd[x].push_back(make_pair(a[v],b[v]));
		else even[x].push_back(make_pair(a[v],b[v]));
		siz[x]+=siz[v];
	}
	sort(odd[x].begin(),odd[x].end(),cmp);
	sort(even[x].begin(),even[x].end(),cmp);
	a[x]=0; b[x]=1;
	int i;
	for (i=0; i<even[x].size(); i++) {
		if (even[x][i].first>even[x][i].second) {
			a[x]+=even[x][i].first;
			b[x]+=even[x][i].second;
		}
		else break;
	}
	for (int j=0; j<odd[x].size(); j++) {
		if (j&1) {
			b[x]+=odd[x][j].first;
			a[x]+=odd[x][j].second;
		}
		else {
			a[x]+=odd[x][j].first;
			b[x]+=odd[x][j].second;
		}
	}
	for (; i<even[x].size(); i++) {
		if (odd[x].size()&1) {
			b[x]+=even[x][i].first;
			a[x]+=even[x][i].second;
		}
		else {
			a[x]+=even[x][i].first;
			b[x]+=even[x][i].second;
		}
	}
}
int main() {
	int n=read();
	for (int i=2; i<=n; i++) {
		int p=read();
		G[p].push_back(i); 
	}
	dfs(1);
	cout<<b[1]<<endl;
	return 0;
}

#include <algorithm>
#include <iostream>
#include <queue>
using namespace std;

struct Tree
{
    int n;
    int r;
    int l;
    std::vector<std::vector<int>> prit;
    std::vector<std::vector<int>> t;
    std::vector<int> par;
    std::vector<int> dpt;
    std::vector<int> tour;
    std::vector<std::vector<int>> appear_on_tour;
    std::vector<std::vector<int>> anc;
    
    Tree(){}
    
    Tree(int n, int r) : n(n), r(r){
        prit.resize(n);
        t.resize(n);
        par.resize(n);
        dpt.resize(n);
    }
    
    void add_edge(int u, int v){
        prit[u].push_back(v);
        prit[v].push_back(u);
    }
    
    void build(){
        for(int i = 0; i < n; i++) dpt[i] = -1;
        std::queue<int> que;
        par[r] = -1;
        dpt[r] = 0;
        que.push(r);
        while(que.size()){
            int u = que.front();
            que.pop();
            for(int v : prit[u]){
                if(dpt[v] == -1){
                    t[u].push_back(v);
                    par[v] = u;
                    dpt[v] = dpt[u] + 1;
                    que.push(v);
                }
            }
        }
    }

/*    std::vector<int> toposort(){
        std::vector<std::pair<int, int>> p(n);
        for(int i = 0; i < n; i++) p[i] = std::pair<int, int>(dpt[i], i);
        sort(p.begin(), p.end(), std::greater<std::pair<int, int>>());
        std::vector<int> res(n);
        for(int i = 0; i < n; i++) res[i] = p[i].second;
        return res;
    }*/
    
    void dfs(int u, int &k){
        appear_on_tour[u].push_back(k);
        tour[k++] = u;
        for(int v : t[u]){
            dfs(v, k);
            appear_on_tour[u].push_back(k);
            tour[k++] = u;
        }
    }
    
    void build_euler_tour(){
        tour.resize(n * 2 - 1);
        appear_on_tour.resize(n);
        int k = 0;
        dfs(0, k);
    }
    
    void build_lca(){
        for(l = 1; l <= n; l++){
            if((1 << (l - 1)) >= n) break;
        }
        anc.resize(l);
        for(int j = 0; j < l; j++) anc[j].resize(n);
        for(int i = 0; i < n; i++) anc[0][i] = par[i];
        for(int j = 1; j < l; j++){
            for(int i = 0; i < n; i++){
                if(anc[j - 1][i] == -1) anc[j][i] = -1;
                else anc[j][i] = anc[j - 1][anc[j - 1][i]];
            }
        }
    }
    
    int lca(int u, int v){
        if(dpt[u] < dpt[v]) std::swap(u, v);
        int dpt_diff = dpt[u] - dpt[v];
        for(int j = l - 1; j >= 0; j--){
            if((dpt_diff >> j) & 1) u = anc[j][u];
        }
        if(u == v) return u;
        for(int j = l - 1; j >= 0; j--){
            if(anc[j][u] != anc[j][v]){
                u = anc[j][u];
                v = anc[j][v];
            }
        }
        return anc[0][u];
    }
};

int size(int u, Tree &t, int *d){
    if(d[u]) return d[u];
    d[u]++;
    for(int v : t.t[u]) d[u] += size(v, t, d);
    return d[u];
}

int dfs(int u, Tree &t, int *d, int *dp){
    if(dp[u]) return dp[u];
    dp[u]--;
    vector<int> p, q;
    for(int v : t.t[u]){
        if(d[v] % 2) p.push_back(dfs(v, t, d, dp));
        else q.push_back(dfs(v, t, d, dp));
    }
    sort(p.begin(), p.end(), greater<int>());
    sort(q.begin(), q.end(), greater<int>());
    for(int i = 0; i < (int)p.size(); i++){
        if(i % 2) dp[u] -= p[i];
        else dp[u] += p[i];
    }
    for(int i = 0; i < (int)q.size(); i++){
        if(q[i] > 0 || !((int)p.size() % 2)) dp[u] += q[i];
        else dp[u] -= q[i];
    }
    return dp[u];
}

int main()
{
    int n;
    cin >> n;
    Tree t(n, 0);
    for(int i = 1; i < n; i++){
        int p;
        cin >> p;
        t.add_edge(i, --p);
    }
    t.build();
    int d[100005]{0}, dp[100005]{0};
    size(0, t, d);
    cout << (n - dfs(0, t, d, dp)) / 2 << endl;
}
