#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define fz(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define ffe(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define fill0(a) memset(a,0,sizeof(a))
#define fill1(a) memset(a,-1,sizeof(a))
#define fillbig(a) memset(a,63,sizeof(a))
#define pb push_back
#define ppb pop_back
#define mp make_pair
template<typename T1,typename T2> void chkmin(T1 &x,T2 y){if(x>y) x=y;}
template<typename T1,typename T2> void chkmax(T1 &x,T2 y){if(x<y) x=y;}
typedef pair<int,int> pii;
typedef long long ll;
template<typename T> void read(T &x){
	x=0;char c=getchar();T neg=1;
	while(!isdigit(c)){if(c=='-') neg=-1;c=getchar();}
	while(isdigit(c)) x=x*10+c-'0',c=getchar();
	x*=neg;
}
const int MAXN=1e5;
int n,hd[MAXN+5],to[MAXN+5],nxt[MAXN+5],ec=0,dp[MAXN+5],siz[MAXN+5];
void adde(int u,int v){to[++ec]=v;nxt[ec]=hd[u];hd[u]=ec;}
void dfs(int x){
	dp[x]=siz[x]=1;int cnt=0;
	for(int e=hd[x];e;e=nxt[e]){
		int y=to[e];dfs(y);
		if(siz[y]&1) cnt++;
		siz[x]+=siz[y];
	} vector<int> v;
	for(int e=hd[x];e;e=nxt[e]){
		int y=to[e];
		if(!(siz[y]&1)&&dp[y]<=0) dp[x]+=dp[y];
		else if(!(siz[y]&1)){
			if(!(cnt&1)) dp[x]+=dp[y];
			else dp[x]-=dp[y];
		}
		else v.pb(dp[y]);
	}
	sort(v.begin(),v.end());
	for(int i=0,t=1;i<v.size();i++,t=-t) dp[x]+=t*v[i];
//	printf("%d %d\n",x,dp[x]);
}
int main(){
	scanf("%d",&n);
	for(int i=2;i<=n;i++){
		int f;scanf("%d",&f);adde(f,i);
	} dfs(1);printf("%d\n",(n+dp[1])/2);
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, k, n) for(ll i = ll(k); i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
const char newl = '\n';

vl S;
vvl G;

void dfs(ll v) {
  S[v] = 1;
  for(ll u: G[v]) {
    dfs(u);
    S[v] += S[u];
  }
}

ll cnt(ll v) {
  ll income = -1;
  vvl vec(3);
  for(ll u: G[v]) {
    ll num = cnt(u);
    if(S[u] & 1) vec[0].push_back(num);
    else if(num >= 0) vec[1].push_back(num);
    else vec[2].push_back(num);
  }

  sort(all(vec[0]), greater<ll>());

  bool f = 0;
  for(ll num: vec[0]) income += ((f = 1-f) ? 1 : -1) * num;
  for(ll num: vec[1]) income += num;
  for(ll num: vec[2]) income += ((vec[0].size() & 1) ? -1 : 1) * num;

  return income;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  ll n, p;
  cin >> n;
  S = vl(n);
  G = vvl(n);
  rep2(i, 1, n-1) {
    cin >> p;
    p--;
    G[p].push_back(i);
  }

  dfs(0);

  cout << (n-cnt(0))/2 << newl;
  return 0;
}