#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }

struct node{
  int f,s;
  node(int ff=1,int ss=0){f=ff,s=ss;}
  node& operator+=(node a) {
    if((f+s)%2){f+=a.f; s+=a.s;}
    else{f+=a.s; s+=a.f;}
    return *this;
  }
};

const int operator<(const node& n1,const node& n2){
  int p1=(n1.f+n1.s)%2,p2=(n2.f+n2.s)%2;
  if(p1==p2){
    return n1.f-n1.s<n2.f-n2.s;
  }
  if(p1==0) return n1.f-n1.s<0;
  return n2.f-n2.s>=0;
}

void dfs(vector<vector<int>>& adj, vector<node>& game,int a=0){
  if(adj[a].size()==0) return;

  for(int v:adj[a]){
    dfs(adj,game,v);
  }
  sort(adj[a].begin(),adj[a].end(),
       [&](int i,int j){return game[i]<game[j];});
  for(int v:adj[a]){
    game[a]+=game[v];
  }
}

int main(){
  int n; cin >>n;
  vector<vector<int>> adj(n);
  rep(i,n-1){
    int p; cin >>p; p--;
    adj[p].push_back(i+1);
  }
  vector<node> game(n);
  dfs(adj,game);
  print(game[0].f);
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cctype>
#include <cmath>
#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <queue>
#include <ctime>
#define _for(i,a,b) for(int i=(a);i<(b);++i)
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long LL;
inline int read_int(){
	int t=0;bool sign=false;char c=getchar();
	while(!isdigit(c)){sign|=c=='-';c=getchar();}
	while(isdigit(c)){t=(t<<1)+(t<<3)+(c&15);c=getchar();}
	return sign?-t:t;
}
inline LL read_LL(){
	LL t=0;bool sign=false;char c=getchar();
	while(!isdigit(c)){sign|=c=='-';c=getchar();}
	while(isdigit(c)){t=(t<<1)+(t<<3)+(c&15);c=getchar();}
	return sign?-t:t;
}
inline char get_char(){
	char c=getchar();
	while(c==' '||c=='\n'||c=='\r')c=getchar();
	return c;
}
inline void write(LL x){
	char c[21],len=0;
	if(!x)return putchar('0'),void();
	if(x<0)x=-x,putchar('-');
	while(x)c[++len]=x%10,x/=10;
	while(len)putchar(c[len--]+48);
}
inline void space(LL x){write(x),putchar(' ');}
inline void enter(LL x){write(x),putchar('\n');}
const int MAXN=1e5+5;
int sz[MAXN],dp[MAXN];
struct Edge{
	int to,next;
}edge[MAXN];
int head[MAXN],edge_cnt;
void Insert(int u,int v){
	edge[++edge_cnt]=Edge{v,head[u]};
	head[u]=edge_cnt;
}
struct Node{
	int d1,d2;
	bool operator < (const Node &b)const{
		return (d1-d2)>(b.d1-b.d2);
	}
};
void dfs(int u){
	sz[u]=1;
	int d1=0,d2=0;
	vector<Node> temp;
	for(int i=head[u];i;i=edge[i].next){
		int v=edge[i].to;
		dfs(v);
		sz[u]+=sz[v];
		if(sz[v]%2==0){
			if(dp[v]*2>=sz[v])
			dp[u]+=dp[v];
			else
			d1+=sz[v]-dp[v],d2+=dp[v];
		}
		else
		temp.push_back(Node{dp[v],sz[v]-dp[v]});
	}
	sort(temp.begin(),temp.end());
	for(int i=0;i<temp.size();i++){
		if(i%2==0)
		dp[u]+=temp[i].d1;
		else
		dp[u]+=temp[i].d2;
	}
	if(temp.size()%2==0)
	dp[u]+=d2;
	else
	dp[u]+=d1;
}
int main()
{
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
	int n=read_int();
	_rep(i,2,n)
	Insert(read_int(),i);
	dfs(1);
	enter(n-dp[1]);
	return 0;
}