#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int MAX_N = 100005;
vector<int> G[MAX_N];
int dp[MAX_N][2]; // 0:f(v) 1:size

void dfs(int n)
{
	if (G[n].size() == 0)
	{
		dp[n][0] = 1;
		dp[n][1] = 1;
		return;
	}
	vector<P> v1,v2,v3;
	int f = 1, s = 1;
	rep(i,G[n].size())
	{
		int c = G[n][i];
		dfs(c);
		if (dp[c][1] % 2 == 0 && dp[c][0] < 0)
		{
			f += dp[c][0];
			s += dp[c][1];
		}
		else if (dp[c][1] % 2 == 0)
		{
			v2.push_back(P(dp[c][0],dp[c][1]));
		}
		else
		{
			v3.push_back(P(dp[c][0],dp[c][1]));
		}
	}

	sort(v3.begin(), v3.end());

	int sign = 1;
	rep(i,v3.size())
	{
		f += sign*v3[i].first;
		s += v3[i].second;
		sign *= -1;
	}

	rep(i,v2.size())
	{
		f += sign*v2[i].first;
		s += v2[i].second;
	}

	dp[n][0] = f;
	dp[n][1] = s;
	return;
}

int main()
{
	int N;
	cin >> N;
	rep(i,N-1)
	{
		int p;
		cin >> p;
		p--;
		G[p].push_back(i+1);
	}

	dfs(0);
	/*
	rep(i,N)
	{
		cout << dp[i][0] << " " << dp[i][1] << endl;
	}
	*/
	cout << (dp[0][0]+N)/2 << endl;
	return 0;
}
#include <bits/stdc++.h>
// #include <atcoder/modint>
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define INF 2000000000000000000
#define ll long long
#define ld long double
#define pll pair<ll, ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

struct d{ll f, s, t;};//first, second, turn

bool comp(d a, d b) {
  if (a.t == 0 || b.t == 0) {
    return a.t > b.t;
  }
  return (a.s - a.f) > (b.s - b.f);
}

ll N;
vector<ll> p;
vector<vector<ll>> child;
d dfs(ll now, ll turn) {
  vector<ll> FS(2, 0);
  FS.at(0) += 1;
  turn = (turn + 1) % 2;
  vector<d> ds;
  for (ll i = 0; i < child.at(now).size(); ++i) {
    d temp = {1, 0, 1};
    if (child.at(child.at(now).at(i)).size() != 0) {
      temp = dfs(child.at(now).at(i), 0);
    }
    if (temp.f <= temp.s && temp.t == 0) {
      FS.at(turn) += temp.s;
      FS.at((turn + 1) % 2) += temp.f;
    }
    else {
      ds.push_back(temp);
    }
  }
  sort(rng(ds), comp);
  for (ll i = 0; i < ds.size(); ++i) {
    d temp = ds.at(i);
    FS.at(turn) += temp.s;
    FS.at((turn + 1) % 2) += temp.f;
    turn = (turn + temp.t) % 2;
  }
  // cout << "now" << now + 1 << "\n";
  // cout << FS.at(0) << ' ' << FS.at(1) << ' ' << turn << "\n";
  return {FS.at(0), FS.at(1), turn};
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N;
  p = vector<ll>(N, -1);
  child = vector<vector<ll>>(N);
  for (ll i = 1; i < N; ++i) {
    cin >> p.at(i);
    p.at(i) -= 1;
    child.at(p.at(i)).push_back(i);
  }
  cout << dfs(0, 0).f << "\n";
}
