#include <bits/stdc++.h>

using namespace std;

vector<int> son[100010];
int n, pv, f[100010];
bool g[100010];

bool cmp(pair<int, bool> x, pair<int, bool> y) {
  if (x.second == y.second) return x.first < y.first;
  if (x.second == 0) return x.first < 0;
  return y.first >= 0;
}

void dfs(int rt) {
  f[rt] = g[rt] = 1;
  if (son[rt].empty()) return;
  vector<pair<int, bool>> tmp;
  for (int i : son[rt]) {
    dfs(i);
    tmp.push_back({f[i], g[i]});
    g[rt] ^= g[i];
  }
  sort(tmp.begin(), tmp.end(), cmp);
  bool flag = 1;
  for (pair<int, int> i : tmp) {
    if (flag)
      f[rt] += i.first; else
      f[rt] -= i.first;
    if (i.second) flag = !flag;
  }
}

int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) {
    scanf("%d", &pv);
    son[pv].push_back(i);
  }
  dfs(1);
  printf("%d\n", (n + f[1]) / 2);
  return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 0x3f3f3f3f
#define m(a) memset(a,0,sizeof(a))
const int N=2e5+5;
int n,m;
int f[N],w[N],T;
vector<int>g[N],b[N];
void work(int k){
	int z=g[k].size();
	int i,er=0;
	w[k]=1;
	for(int i=0;i<z;i++){
		int y=g[k][i];
		work(y);
		w[k]+=w[y];
		if(w[y]%2==0){
			if(f[y]>0)f[k]+=f[y];
			else er+=f[y];
		}
		else b[k].push_back(f[y]);
	}
	f[k]+=er*(w[k]%2*2)-er;
	sort(b[k].begin(),b[k].end());
	for(int i=0;i<b[k].size();i++){
		f[k]+=b[k][i]*(1-(b[k].size()-1-i)%2*2);
	}
	f[k]--;
}
int main(){
	int n;cin>>n;
	for(int i=2;i<=n;i++){
		int x;cin>>x;
		g[x].push_back(i);
	}
	work(1);
	int maxs=0;
	for(int i=1;i<=n;i++){
		maxs=max(maxs,f[i]);
	}
	cout<<(n-f[1])/2;
}