#include <cstdio>
#include <vector>
#include <algorithm>

int n;
std::vector<int> tree[100000];

constexpr int INF = 100000000;

int size[100000];
int dp[100000];

int size_dfs(int v){
  for(int c: tree[v]){
    size[v] += size_dfs(c);
  }
  return size[v] += 1;
}

int dfs(int v){
  if(dp[v] != INF) return dp[v];

  dp[v] = 1;
  int other = 0;
  std::vector<int> rest;
  for(int c: tree[v]){
    int w = dfs(c);
    if(size[c] % 2 == 0 && w < 0) dp[v] += w;
    else if(size[c] % 2 == 1) rest.push_back(w);
    else other += w;
  }
  std::sort(rest.begin(), rest.end());
  for(int i = 0; i < rest.size(); i++){
    dp[v] += rest[i++];
    if(i < rest.size()) dp[v] -= rest[i];
  }
  if(rest.size() % 2 == 0) dp[v] += other;
  else dp[v] -= other;

// printf("%d %d\n", v, dp[v]);
  return dp[v];
}

int main(){
  scanf("%d", &n);
  for(int i = 0; i < n-1; i++){
    int p;
    scanf("%d", &p);
    tree[p-1].push_back(i+1);
  }

  size_dfs(0);

  for(int i = 0; i < n; i++) dp[i] = INF;
  auto z = dfs(0);

  printf("%d\n", (z + n)/2);

  return 0;
}

#include <bits/stdc++.h>

using namespace std;

typedef pair<int,int> ii;

vector<vector<int>> adj;
vector<int> p, sz;

void dfs(int u){
  sz[u] = 1;
  for(int v : adj[u]){
    if(v != p[u]){
      dfs(v);
      sz[u] += sz[v];
    }
  }
}

vector<int> memo;

int max_coins(int u){
  if(memo[u] != -1) return memo[u];
  vector<ii> balances_even, balances_odd;

  for(int v : adj[u]){
    if(v == p[u]) continue;
    int p1 = max_coins(v);
    int p2 = sz[v] - p1;
    int balance = p1 - p2;

    if(sz[v] & 1){
      balances_odd.push_back({balance, v});
    } else {
      balances_even.push_back({balance, v});
    }
  }

  sort(balances_even.begin(), balances_even.end());
  sort(balances_odd.begin(), balances_odd.end());
  int coins = 0;

  while(!balances_even.empty() and
	balances_even.back().first > 0){
    int v = balances_even.back().second;
    coins += max_coins(v);
    balances_even.pop_back();
  }

  int p = 0;

  while(!balances_odd.empty()){
    int v = balances_odd.back().second;
    if(p == 0) coins += max_coins(v);
    else coins += sz[v] - max_coins(v);
    balances_odd.pop_back();
    p ^= 1;
  }

  while(!balances_even.empty()){
    int v = balances_even.back().second;
    if(p == 0) coins += max_coins(v);
    else coins += sz[v] - max_coins(v);
    balances_even.pop_back();
  }

  return memo[u] = coins;
}

int main(){
  int n;
  while(scanf("%d", &n) > 0){
    adj.assign(n+1, vector<int>());
    sz.assign(n+1, 0);
    p.assign(n+1, 0);

    for(int i = 2; i <= n; i++){
      scanf("%d", &p[i]);
      adj[p[i]].push_back(i);
    }

    dfs(1);

    memo.assign(n+1, -1);
    printf("%d\n", sz[1] - max_coins(1));
  }
}
