#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
const int BUF = 100005;


class ChildData {
public:
    int subtreeNode;
    int fstTake, scdTake;

    ChildData(){}
    ChildData(int sb, int f, int scd):
        subtreeNode(sb), fstTake(f), scdTake(scd) {}
    
    bool operator< (const ChildData &opp) const {
        return fstTake - scdTake < opp.fstTake - opp.scdTake;
    }
};


int nNode;
vector<int> adj[BUF];

void read() {
    for (int i = 0; i < BUF; ++i) adj[i].clear();
    
    cin >> nNode;
    for (int i = 1; i < nNode; ++i) {
        int pre;
        cin >> pre;
        --pre;
        adj[pre].push_back(i);
        adj[i].push_back(pre);
    }
}


ChildData rec(int cur, int pre) {
    ChildData ret(0, 0, 0);
    
    vector<ChildData> childResult;
    vector<ChildData> evenResult;

    for (int i = 0; i < adj[cur].size(); ++i) {
        int nex = adj[cur][i];
        if (nex == pre) continue;

        ChildData candi = rec(nex, cur);
        if (candi.subtreeNode % 2 == 0) {
            if (candi.fstTake - candi.scdTake < 0) {
                ret.subtreeNode += candi.subtreeNode;
                ret.fstTake += candi.fstTake;
                ret.scdTake += candi.scdTake;
            } else {
                evenResult.push_back(candi);
            }
        } else {
            childResult.push_back(candi);
        }
    }
    
    sort(childResult.begin(), childResult.end());
    
    for (int i = 0; i < childResult.size(); ++i) {
        ChildData &r = childResult[i];
        if (i % 2 == 0) {
            ret.subtreeNode += r.subtreeNode;
            ret.fstTake += r.fstTake;
            ret.scdTake += r.scdTake;
        } else {
            ret.subtreeNode += r.subtreeNode;
            ret.fstTake += r.scdTake;
            ret.scdTake += r.fstTake;
        }
    }
    for (int i = 0; i < evenResult.size(); ++i) {
        ChildData &r = evenResult[i];
        if (ret.subtreeNode % 2 == 0) {
            ret.subtreeNode += r.subtreeNode;
            ret.fstTake += r.fstTake;
            ret.scdTake += r.scdTake;
        } else {
            ret.subtreeNode += r.subtreeNode;
            ret.fstTake += r.scdTake;
            ret.scdTake += r.fstTake;
        }
    }
    
    ++ret.subtreeNode;
    ++ret.fstTake;

    return ret;
}

void work() {
    cout << rec(0, -1).fstTake << endl;
}


int main() {
    read();
    work();
    return 0;
}

#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

int P[100001];
int sei[100001], fu[100001], kisuu[100001], kazu[100001], kazu2[100001];
void sort_ganbare(int N, int A[]) {
	if (N < (1 << 12)) {
		sort(A, A + N);
		return;
	}
	const int b = 9;
	int tmp[100001];
	int kazu[1 << b] = {}, kazu2[1 << b] = {};
	rep(i, N) kazu[A[i] & ((1 << b) - 1)]++;
	rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
	for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] & ((1 << b) - 1)]] = A[i];
	rep(i, N) kazu2[tmp[i] >> b & ((1 << b) - 1)]++;
	rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
	for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> b & ((1 << b) - 1)]] = tmp[i];
}
const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);


	int N = getint();
	rep1(i, N - 1) {
		kazu[(P[i + 1] = getint())]++;
	}
	rep(i, N) kazu2[i + 1] = (kazu[i + 1] += kazu[i]);

	for (int i = N; i >= 2; i--) {
		int ret = sei[i] - 1;

		auto ki = kisuu + kazu[i - 1];
		int sz = kazu2[i - 1] - kazu[i - 1];
		sort_ganbare(sz, ki);

		if (sz & 1) {
			ret -= fu[i];
			rep(j, sz) {
				if (j & 1) ret -= ki[j] - (1 << 17);
				else ret += ki[j] - (1 << 17);
			}
		}
		else {
			ret += fu[i];
			rep(j, sz) {
				if (j & 1) ret += ki[j] - (1 << 17);
				else ret -= ki[j] - (1 << 17);
			}
		}

		if (ret & 1) {
			kisuu[kazu2[P[i] - 1]++] = ret + (1 << 17);
		}
		else {
			if (ret >= 0) sei[P[i]] += ret;
			else fu[P[i]] += ret;
		}
	}

	int ret = sei[1] - 1;

	auto ki = kisuu + kazu[0];
	int sz = kazu2[0] - kazu[0];
	sort_ganbare(sz, ki);

	if (sz & 1) {
		ret -= fu[1];
		rep(j, sz) {
			if (j & 1) ret -= ki[j] - (1 << 17);
			else ret += ki[j] - (1 << 17);
		}
	}
	else {
		ret += fu[1];
		rep(j, sz) {
			if (j & 1) ret += ki[j] - (1 << 17);
			else ret -= ki[j] - (1 << 17);
		}
	}

	co((N - ret) / 2);

	Would you please return 0;
}