#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 2e5+5;

typedef pair <int,int> pii;
#define x first
#define y second

int csub[sz], dp[sz];
vector <int> g[sz];

void dfs(int u) {
   csub[u] = dp[u] = 1;
   vector <pii> od, ev;
   for(int v : g[u]) {
      dfs(v);
      csub[u] += csub[v];
      if(csub[v] & 1) od.emplace_back(csub[v] - 2 * dp[v], v);
      else ev.emplace_back(csub[v] - 2 * dp[v], v);
   }
   sort(od.begin(), od.end(), greater<pii>());
   sort(ev.begin(), ev.end(), greater<pii>());
   int ei = 0, oi = 0;
   for(; ei<ev.size(); ei++) {
      auto v = ev[ei].y;
      if(csub[v] - dp[v] > dp[v]) dp[u] += dp[v];
      else break;
   }
   for(; oi<od.size(); oi++) {
      auto v = od[oi].y;
      if(oi & 1) dp[u] += csub[v] - dp[v];
      else dp[u] += dp[v];
   }
   for(; ei<ev.size(); ei++) {
      auto v = ev[ei].y;
      if(oi & 1) dp[u] += csub[v] - dp[v];
      else dp[u] += dp[v];
   }
}

int main() {
   int n;
   cin >> n;
   for(int i=2; i<=n; i++) {
      int j;
      scanf("%d", &j);
      g[j].push_back(i);
   }
   dfs(1);
   cout << dp[1];
}

#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;
}