#include <bits/stdc++.h>
using namespace std;
//#include <atcoder/all>
//using namespace atcoder;

/*---------macro---------*/
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, s, n) for (int i = s; i < (int)(n); ++i)
#define Clear(a) a = decltype(a)()
#define all(a) begin(a),end(a)
#define rall(a) rbegin(a),rend(a)
#define bit(i,j) ((i>>j)&1)

/*---------type/const---------*/
typedef long long ll;
typedef unsigned long long ull;
typedef string::const_iterator state; //構文解析
const ll big=1000000007;
//const ll big=998244353;
const double PI=acos(-1);
const double EPS=1e-8;//適宜変える
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const char newl='\n';
struct{
    constexpr operator int(){return -int(1e9)-1;}
    constexpr operator ll(){return -ll(1e18)-1;}
}neginf;
struct{
    constexpr operator int(){return int(1e9)+1;}
    constexpr operator ll(){return ll(1e18)+1;}
    constexpr auto operator -(){return neginf;}
}inf;

/*---------debug---------*/
#ifdef LOGX
#include <template/debug.hpp>
#define _GLIBCXX_DEBUG
#else
#define dbg(x) ;
#define prt(x) ;
#define _prt(x) ;
#endif

/*---------function---------*/
template<typename T,typename U> T max(const T x,const U y){if(x>y)return x;else return y;}
template<typename T,typename U> T min(const T x,const U y){if(x<y)return x;else return y;}
template<typename T> T max(const vector<T> &a){T ans=a[0];for(T elem:a){ans=max(ans,elem);}return ans;}
template<typename T> T min(const vector<T> &a){T ans=a[0];for(T elem:a){ans=min(ans,elem);}return ans;}
template<typename T,typename U> bool chmin(T &a,const U b){if(a>b){a=b;return true;}return false;}
template<typename T,typename U> bool chmax(T &a,const U b){if(a<b){a=b;return true;}return false;}
bool valid(int i,int j,int h,int w){return (i>=0 && j>=0 && i<h && j<w);}
template<typename T,typename U>
T expm(T x,U y,const ll mod=big){
    T res=1;
    while(y){
        if(y&1)(res*=x)%=mod;
        (x*=x)%=mod;
        y>>=1;
    }
    return res;
}
template<typename T,typename U>
T exp(T x,U y){
    T res=1;
    while(y){
        if(y&1)res*=x;
        x*=x;
        y>>=1;
    }
    return res;
}

int n;
vector<int> p;
vector<vector<int>> g;//g[i][0]がiの親.
vector<vector<bool>> notmy;
vector<int> ans;

//「自分」「相手」の辺を決定する.
bool dfs(int i){
    if(i!=0 && g[i].size()==1)return true;
    bool res=false;
    rep2(j,int(i!=0),g[i].size()){
        res^=(notmy[i][j]=dfs(g[i][j]));
    }
    return !res;
}

//その頂点「に」移動させることを選択した人がどれだけ獲得するか？
int calc(int i){
    if(g[i].size()==1 && i!=0){
        return ans[i]=-1;
    }

    vector<int> mine;
    vector<int> ene;
    rep2(j,int(i!=0),g[i].size()){
        if(notmy[i][j])ene.emplace_back(calc(g[i][j]));
        else mine.emplace_back(calc(g[i][j]));
    }

    sort(rall(mine));
    sort(rall(ene));

    int res=-1;
    //「ene」の個数が偶数個なら, mineは全て自分でとることになる.
    if(ene.size()%2==0){
        for(auto &e:mine)res+=e;
        rep(j,ene.size()){
            if(j%2==0)res+=ene[j];
            else res-=ene[j];
        }
    }
    else{
        for(auto &e:mine)res+=abs(e);
        rep(j,ene.size()){
            if(j%2==0)res+=ene[j];
            else res-=ene[j];
        }
    }
    return ans[i]=res;
}

int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout.precision(10);
    /*--------------------------------*/
    
    cin >> n;
    p.resize(n);
    g.resize(n);
    rep(i,n-1){
        cin >> p[i+1];
        p[i+1]--;
        g[i+1].emplace_back(p[i+1]);
        g[p[i+1]].emplace_back(i+1);
    }
    notmy.resize(n);
    rep(i,n){
        notmy[i].resize(g[i].size());
    }
    ans.resize(n,0);
    dfs(0);
    dbg(notmy);
    calc(0);
    dbg(ans);
    cout << (n-ans.front())/2 << newl;
}
    //For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;
    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            ll l,i,j,k;
            cin>>l;
            ll dp[l+1][13];
            for(i=0;i<=l;++i)
            {
                for(j=0;j<=12;++j)
                    dp[i][j]=0;
            }
            for(i=1;i<=l;++i)
            {
                dp[i][1]=1;
                for(j=2;j<=12;++j)
                {
                    for(k=i-1;k>=1;--k)
                    {
                        dp[i][j]=dp[i][j]+dp[k][j-1];
                    }
                    // cout<<i<<" "<<j<<" "<<dp[i][j]<<endl;
                }
            }
            cout<<dp[l][12]<<endl;
        }
        return 0;
    }
