#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //int:2*10**9
typedef long double ld;
typedef pair<ll,ll> P;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007 //998244353
#define PI 3.141592653
#define INF 100000000000000 //14
//cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);
#define N 100100

vector<vector<ll>> conn(N);

vector<vector<ll>> ansc(N,vector<ll>(3,0));

void dfs(ll now, ll prev) {
    ll first = 1; ll second = 0; ll third = 1;
    ll secondf = 0; ll seconds = 0;
    vector<vector<ll>> ones;
    for (ll nex : conn[now]) {
        // cout << now << " " << nex << endl;
        if (nex==prev) continue;
        dfs(nex,now);
        ll pfirst = ansc[nex][0];
        ll psecond = ansc[nex][1];
        ll pthird = ansc[nex][2];
        third += pthird;
        if (pthird==0) {
            if (pfirst<=psecond) {
                first += pfirst;
                second += psecond;
            }
            else {
                secondf += pfirst;
                seconds += psecond;
            }
        }
        else {
            ones.pb({pfirst-psecond,pfirst,psecond});
        }
    }
    third%=2;
    // cout << now << " " << first << " " << second << " " << third << endl;
    if (third%2) {
        first += secondf; second += seconds;
    }
    else {
        second += secondf; first += seconds;
    }
    sort(ones.begin(),ones.end());
    REP(i,ones.size()) {
        if (i%2==0) {
            first += ones[i][1]; second += ones[i][2];
        }
        else {
            first += ones[i][2]; second += ones[i][1];
        }
    }
    ansc[now]={first,second,third};
    return;
}

int main(){
    ll n; cin >> n;
    REP(i,n-1) {
        ll p; cin >> p; p--;
        conn[i+1].pb(p); conn[p].pb(i+1);
    }
    dfs(0,-1);
    // REP(i,n) {
    //     cout << ansc[i][0] << " " << ansc[i][1] << " " << ansc[i][2] << endl;
    // }
    cout << ansc[0][0] << endl;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define For(i,a,b) for(register int i=a;i<=b;++i)
#define Down(i,a,b) for(register int i=a;i>=b;i--)
#define reg register
namespace yspm{
	inline int read(){
		int res=0,f=1; char k;
		while(!isdigit(k=getchar())) if(k=='-') f=-1;
		while(isdigit(k)) res=res*10+k-'0',k=getchar();
		return res*f;
	}
	const int N=1e5+10;
	inline int min(int x,int y){return x<y?x:y;}
	inline int max(int x,int y){return x>y?x:y;}
	inline void swap(int &x,int &y){int t=x; x=y; y=t; return ;}
	vector<int>g[N];
	int sz[N],f[N],n;
	inline void dfs(int x){
		sz[x]=1; vector<int> ev,od; f[x]=-1; 
		for(auto t:g[x]) dfs(t),sz[x]^=sz[t],sz[t]?od.push_back(f[t]):ev.push_back(f[t]);
		sort(od.begin(),od.end()); reverse(od.begin(),od.end());
		sort(ev.begin(),ev.end()); reverse(ev.begin(),ev.end());
		int ne=0,no=0,fl=0; 
		while(ne<ev.size()&&ev[ne]>0) f[x]+=ev[ne],++ne; 
		while(no<od.size()) fl?f[x]-=od[no]:f[x]+=od[no],++no,fl^=1; 
		while(ne<ev.size()) fl?f[x]-=ev[ne]:f[x]+=ev[ne],++ne;
		return ;
	}
	signed main(){
		n=read(); for(reg int i=2,tf;i<=n;++i) tf=read(),g[tf].push_back(i); dfs(1); 
		printf("%lld\n",(n-f[1])/2);
		return 0;
	}
}
signed main(){return yspm::main();}

