#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> bata;
vector<int> dscore, nscore;
vector<int> stsize;

void getScores(int v) {
    nscore[v] = 1;
    dscore[v] = 0;
    stsize[v] = 1;
    if (bata[v].size() == 0) {
//        printf("%d d n s %d %d %d\n", v, dscore[v], nscore[v], stsize[v]);
        return;
    }
    // dckids are all disadvantaged
    vector<int> dckids, ndckids;
    auto take = [&] (int c, int curDecider) { // 0 = the initial decider, 1 = the initial non-decider
        (curDecider == 0 ? dscore : nscore)[v] += dscore[c];
        (curDecider == 1 ? dscore : nscore)[v] += nscore[c];
    };
    for (int c : bata[v]) {
        getScores(c);
        stsize[v] += stsize[c];
        if (stsize[c] % 2 == 0) {
            if (dscore[c] >= nscore[c]) { // decider pre-takes this
                take(c, 0);
            } else {
                dckids.push_back(c);
            }
        } else {
            ndckids.push_back(c);
        }
    }
    sort(begin(ndckids), end(ndckids), [&] (int i, int j) {
        return dscore[i] - nscore[i] > dscore[j] - nscore[j];
    });
    int curPlayer = 0;
    for (int c : ndckids) {
        take(c, curPlayer);
        curPlayer = 1 - curPlayer;
    }
    for (int c : dckids) take(c, curPlayer);
//    printf("%d d n s %d %d %d\n", v, dscore[v], nscore[v], stsize[v]);
}

int main() {
    int n; scanf("%d", &n);
    dscore = nscore = stsize = vector<int>(n, -1);
    bata.assign(n, vector<int>());
    for (int i = 1; i < n; ++i) {
        int p; scanf("%d", &p);
        bata[p-1].push_back(i);
    }
    getScores(0);
    printf("%d\n", nscore[0]);
    return 0;
}

#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;
}