#include<bits/stdc++.h>
#define rei register int
#define pb push_back
using namespace std;
const int maxn = 100010;
int n;
int dp[maxn],g[maxn],sz[maxn];
vector<int>ver[maxn];
void dfs(int x){ g[x] = sz[x] = 1; int cnt = 0;
	for(rei i = 0;i < ver[x].size();++i) dfs(ver[x][i]); 
	for(rei i = 0;i < ver[x].size();++i) cnt ^= g[ver[x][i]];
	for(rei i = 0;i < ver[x].size();++i) g[x] ^= g[ver[x][i]],sz[x] += sz[ver[x][i]];
	for(rei i = 0;i < ver[x].size();++i) if(g[ver[x][i]] == 0){
		if(sz[ver[x][i]] - dp[ver[x][i]] <= dp[ver[x][i]]) dp[x] += dp[ver[x][i]];
		else if(cnt == 1) dp[x] += sz[ver[x][i]] - dp[ver[x][i]]; 
		else dp[x] += dp[ver[x][i]];
	} vector<pair<int,int > >st; 
	for(rei i = 0;i < ver[x].size();++i) if(g[ver[x][i]] == 1) st.pb(make_pair(2 * dp[ver[x][i]] - sz[ver[x][i]],dp[ver[x][i]]));
	sort(st.begin(),st.end()); reverse(st.begin(),st.end());
	for(rei i = 0;i < st.size();i += 2) dp[x] += st[i].second; 
	for(rei i = 1;i < st.size();i += 2) dp[x] += st[i].second - st[i].first;
} int main(){
	cin >> n; for(rei i = 1;i < n;++i){
		int x; scanf("%d",&x); ver[x].pb(i + 1);
	} dfs(1); 
//	for(rei i = 1;i <= n;++i) cerr << dp[i] << " " << g[i] << endl;
	
	cout << n - dp[1]; 
}
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, k, n) for (int i = k; i < (int)(n); i++)
#define repd(i, n) for (int i = n-1; i >= 0; i--)
#define rrepd(i, k, n) for (int i = n-1; i >= (int)(k); i--)
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define PB push_back //挿入
#define MP make_pair //pairのコンストラクタ
//V,Pは大文字i,l,bは小文字
using ll = long long;
using Vi = vector<int>;
using VVi = vector<Vi>;
using Vl = vector<ll>;
using VVl = vector<Vl>;
using Vb = vector<bool>;
using VVb = vector<Vb>;
using P = pair<int,int>;
using Pl = pair<ll, ll>;
using Vs = vector<string>;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;//10の18乗
#define yn {puts("Yes");}else{puts("No");}
#define dame { puts("-1"); return 0;}

int main(){
    ll n;
    cin >> n;
    Vl v(n);
    VVl to(n);
    rep(i,n-1){
        cin >> v[i+1];
        v[i+1]--;
        to[v[i+1]].PB(i+1);
    }
    Vl dp(n),dp2(n);
    repd(i,n){
        ll sen=1,go=0;
        vector<P> can;//奇数の行き先
        ll last=0,last2=0;
        for(int j:to[i]){
            ll x=dp[j],y=dp2[j];
            if((x+y)%2==0){
                if(x<=y){
                    sen+=x;go+=y;
                }
                else{
                    last+=x;
                    last2+=y;                    
                }
            }
            else{
                can.PB(MP(x-y,x));//相手に利益が低いものを押し付ける
            }
        }
        sort(all(can));
        rep(j,can.size()){
            if(j%2==1){
                go+=can[j].S;
                sen+=(-can[j].F+can[j].S);
            }
            else{
                sen+=can[j].S;
                go+=(-can[j].F+can[j].S);
                
            }
        }
        if(can.size()%2==0){//?
            sen+=last;
            go+=last2;
        }
        else{
            sen+=last2;
            go+=last;
        }
        dp[i]=sen;dp2[i]=go;
        //cout << last << endl;
    }
    cout << dp[0] << endl;
    //rep(i,n) cout << dp[i] << endl;
    //rep(i,n) cout << dp2[i] << endl;
}



