#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[100001];
long long vis[100001];
long long level[100001];
long long nodes[100001];
void bfs(long long s) {
  queue<long long> q;
  q.push(s);
  vis[s] = 1;
  while (!q.empty()) {
    long long f = q.front();
    q.pop();
    for (auto it = adj[f].begin(); it != adj[f].end(); ++it) {
      if (vis[*it] == 0) {
        q.push(*it);
        level[*it] = level[f] + 1;
        nodes[level[*it]]++;
        vis[*it] = 1;
      }
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  for (long long i = 2; i <= n; i++) {
    long long tmp;
    cin >> tmp;
    adj[tmp].push_back(i);
  }
  nodes[0] = 1;
  bfs(1);
  long long mx = 0, cnt = 0, ans = 0;
  for (long long i = 1; i <= n; i++) {
    mx = max(mx, level[i]);
  }
  for (long long i = 0; i <= mx; i++) {
    ans += (nodes[i] % 2);
    cnt = 0;
  }
  cout << ans;
  return 0;
}
