#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define all(a) a.begin(), a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define range(i, a, b) for (ll i = (a); i < (b); i++)
#define rrange(i, a, b) for (ll i = (b) - 1; i >= (a); i--)
#define pb push_back
#define debug(x) cerr << __LINE__ << ' ' << #x << ':' << (x) << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
template<class T> using pri_s = priority_queue<T, vector<T>, greater<T>>;
template<class T> using pri_b = priority_queue<T>;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr int mod1e9 = 1000000007;
constexpr int mod998 = 998244353;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
constexpr ll ten(int n) { return n ? 10 * ten(n - 1) : 1; };
int dx[] = { 1,0,-1,0,1,1,-1,-1 }; int dy[] = { 0,1,0,-1,1,-1,1,-1 };
void fail() { cout << "-1\n"; exit(0); } void no() { cout << "No\n"; exit(0); }
template<class T> void er(T a) { cout << a << '\n'; exit(0); }
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }
template<class T> istream &operator >> (istream &s, vector<T> &v) { for (auto &e : v) s >> e; return s; }
template<class T> ostream &operator << (ostream &s, const vector<T> &v) { for (auto &e : v) s << e << ' '; return s; }
template<class T, class U> ostream &operator << (ostream &s, const pair<T, U> &p) { s << p.first << ' ' << p.second; return s; }

struct fastio {
	fastio() {
		cin.tie(0); cout.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(20);
		cerr << fixed << setprecision(20);
	}
}fastio_;

const int N = ten(5) + 10;
vector<vector<int>> graph(N, vector<int>());
vector<int> sz(N, 1), dp(N, 1);

void dfs(int n) {
	vector<P> p;
	for (int i : graph[n]) {
		dfs(i);
		sz[n] += sz[i];
		p.pb({ sz[i] - 2 * dp[i],sz[i] % 2 });
		dp[n] += sz[i] - dp[i];
	}
	sort(all(p), greater<P>());
	int t = 0; int sum = 0;
	for (auto q : p) {
		if (q.first > 0 && q.second == 0) {
			dp[n] -= q.first;
		}
		if (q.second == 1) {
			if (t == 0) {
				dp[n] -= q.first;
			}
			t ^= 1;
		}
		if (q.first < 0 && q.second == 0) {
			sum += q.first;
		}
	}
	if (t == 0) dp[n] -= sum;
}

int main() {
	int n;
	cin >> n;
	for (int i = 1; i < n; i++) {
		int v;
		cin >> v;
		v--;
		graph[v].pb(i);
	}
	dfs(0);
	cout << dp[0] << '\n';
}
//#include <bits/stdc++.h>
//using namespace std;
//typedef long long ll;
//typedef pair<int, int> pi;
//typedef pair<ll, ll> pll;
//
//vector<int> V[100001], odd[100001];
//
//int f[100001], sz[100001];
//
//void dfs(int pos) {
//	f[pos] = -1, sz[pos] = 1;
//
//	int sum = 0;
//	for (int w : V[pos]) {
//		dfs(w); sz[pos] += sz[w];
//		if (sz[w] & 1) odd[pos].push_back(w);
//		else {
//			if (f[w] >= 0) f[pos] += f[w];
//			else sum += f[w];
//		}
//	}
//	sort(odd[pos].begin(), odd[pos].end(), [&](int a, int b) -> bool {
//		return f[a] > f[b];
//		});
//	bool aoki = false;
//	for (int w : odd[pos]) {
//		f[pos] += (aoki ? -1 : 1) * f[w];
//		aoki = !aoki;
//	}
//
//	if (odd[pos].size() & 1) f[pos] -= sum;
//	else f[pos] += sum;
//}
//
//int main() {
//	ios::sync_with_stdio(0);
//	cin.tie(0), cout.tie(0);
//
//	int n; cin >> n;
//	for (int i = 2; i <= n; i++) {
//		int a; cin >> a;
//		V[a].push_back(i);
//	}
//	cout << (n - f[1]) / 2;
//
//	return 0;
//}

#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 10;

int n, fa[N], siz[N], f[N];
vector <int> g[N];

void dfs_(int u) {
	f[u] = -1, siz[u] = 1;
	int tot = 0;
	vector<int> odd;
	for (int v : g[u]) {
		dfs_(v), siz[u] += siz[v];
		if (siz[v] & 1) odd.push_back(v);
		else {
			if (f[v] >= 0) f[u] += f[v];
			else tot += f[v];
		}
	}
	sort(odd.begin(), odd.end(), [&](int a, int b) -> bool {
		return f[a] > f[b];
		});

	bool aoki = false;
	for (int w : odd) {
		f[u] += (aoki ? -1 : 1) * f[w];
		aoki = !aoki;
	}

	if (odd.size() & 1)
		f[u] -= tot;
	else
		f[u] += tot;
}

int main() {
	scanf("%d", &n);
	for (int i = 2; i <= n; i++)
		scanf("%d", &fa[i]), g[fa[i]].push_back(i);
	dfs_(1);
	printf("%d\n", (n - f[1]) / 2);
}
