#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

vector<int> subtree_size, score;

void dfs(vector<vector<int>> &g, int v){
	int sum = 0;
	vector<int> vec;
	for(auto nv : g[v]){
		dfs(g, nv);
		subtree_size[v] += subtree_size[nv];
		if(subtree_size[nv]%2 == 1) vec.push_back(-score[nv]);
		else if(score[nv] < 0) score[v] -= -score[nv];
		else sum += -score[nv];
	}
	sort(vec.rbegin(), vec.rend());
	vec.push_back(sum);
	rep(i,vec.size()){
		if(i%2 == 1) score[v] += vec[i];
		else score[v] -= vec[i];
	}
}

void solve(){
	int n;
	cin >> n;
	vector<vector<int>> g(n);
	subtree_size.assign(n, 1);
	score.assign(n, 1);
	rep(i,n-1){
		int p;
		cin >> p;
		--p;
		g[p].push_back(i+1);
	}
	dfs(g, 0);
	int ans = (n + score[0]) / 2;
	cout << ans << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}
#include <iostream>
#include <algorithm>
#include <vector>

const int MAXN = 100005;

std::vector<int> Adj[MAXN];

std::pair<int, int> dfs(int u) {
  std::pair<int, int> ret = {1, 1};
  std::vector<int> choices[2];

  for(int j : Adj[u]) {
    std::pair<int, int> next = dfs(j);
    ret.second ^= next.second;
    choices[next.second].push_back(next.first);
  }

  int odd = choices[1].size();
  for(int i = 0; i < choices[0].size(); i++) {
    if(choices[0][i] < 0)
      ret.first += choices[0][i];
    else
      ret.first += (1 - 2*(odd%2))*choices[0][i];
  } 
  
  std::sort(choices[1].begin(), choices[1].end());
  for(int i = 0; i < choices[1].size(); i++)
    ret.first += (1 - 2*(i%2))*choices[1][i];

  return ret;
}

signed main() {
  int n;
  std::cin >> n;

  for(int i = 1; i < n; i++) {
    int p;
    std::cin >> p;
    p--;
    Adj[p].push_back(i);
  }

  std::cout << (dfs(0).first + n)/2 << std::endl;

  return 0;
}

