#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define ff first
#define ss second
using namespace std;
ll F[200009],S[200009],sz[200009];
map<ll,ll> mp;
vector<ll> G[100009];
bool cmp(const ll &a,const ll &b)
{
    return S[a]-F[a] > S[b]-F[b];
}
void DFS(ll u)
{
    vector<ll> tp,bd;
    ll i;
    sz[u] = 1;
    F[u] = 1;
    S[u] = 0;
    for(auto v : G[u])
    {
        DFS(v);
        sz[u] += sz[v];
        if(sz[v] % 2 == 0)
        {
            if(S[v] >= F[v])
            {
                S[u] += S[v];
                F[u] += F[v];
            }
            else
            {
                bd.push_back(v);
            }
        }
        else
        {
            tp.push_back(v);
        }
    }
    sort(tp.begin(),tp.end(),cmp);
    for(i = 0;i < tp.size();i++)
    {
        if(i & 1)
        {
            F[u] += S[tp[i]];
            S[u] += F[tp[i]];
        }
        else
        {
            F[u] += F[tp[i]];
            S[u] += S[tp[i]];
        }
    }
    for(auto x : bd)
    {
        if(sz[u] % 2 == 1)
        {
            F[u] += F[x];
            S[u] += S[x];
        }
        else
        {
            F[u] += S[x];
            S[u] += F[x];
        }
    }

}
int main()
{
    ll N,Q,M,i,j,k,t,ans,l,r;
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> N;
    for(i = 2;i <= N;i++)
    {
        cin >> t;
        G[t].push_back(i);
    }
    DFS(1);
    cout << F[1] << endl;
}

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

ll n;
vvl G;
vl dp;
vl Size;  // Size[v] : vの部分木のサイズ

void dfs1(ll v, ll p = -1) {
    Size[v] = 1;
    for(ll u : G[v]) {
        if(u == p) {
            continue;
        }
        dfs1(u, v);
        Size[v] += Size[u];   
    }
}

void dfs2(ll v, ll p = -1) {
    dp[v] = 1;
    ll x = 0;
    vl vec;
    for(ll u : G[v]) {
        if(u == p) {
            continue;
        }
        dfs2(u, v); 
        if(Size[u]%2 == 0) {
            if(dp[u] < 0) {
                dp[v] += dp[u];
            }
            else {
                x += dp[u];
            }
        }
        else {
            vec.pb(dp[u]);
        }
    }
    sort(all(vec));
    ll k = vec.size();
    rep(i, k) {
        if(i%2 == 0) {
            dp[v] += vec[i];
        }
        else {
            dp[v] -= vec[i];
        }
    }
    if(k%2 == 0) {
        dp[v] += x;
    }
    else {
        dp[v] -= x;
    }
}

int main() {
    
    cin >> n;    
    
    G.resize(n);
    exrep(i, 1, n-1) {
        ll p;
        cin >> p;
        p--;  
        G[i].pb(p);
        G[p].pb(i);
    }

    Size.resize(n);
    dfs1(0);
    
    dp.resize(n);
    dfs2(0);

    out((n + dp[0])/2);
    re0;
}