#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100001];
int vis[100001];
int level[100001], nodes[100001];
void bfs(int s) {
  queue<int> q;
  q.push(s);
  vis[s] = 1;
  while (!q.empty()) {
    int p = q.front();
    q.pop();
    for (int i = 0; i < adj[p].size(); i++) {
      if (vis[adj[p][i]] == false) {
        q.push(adj[p][i]);
        level[adj[p][i]] = level[p] + 1;
        nodes[level[adj[p][i]]]++;
        vis[adj[p][i]] = true;
      }
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int a;
    cin >> a;
    adj[a].push_back(i);
  }
  nodes[0] = 1;
  bfs(1);
  int mx = 0;
  for (int i = 1; i <= n; i++) {
    mx = max(mx, level[i]);
  }
  int count = 0, ans = 0;
  for (int i = 0; i <= mx; i++) {
    ans += (nodes[i] % 2);
  }
  cout << ans;
  return 0;
}
