#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, j, k, n, t;
  cin >> n;
  vector<long long> adj[n + 1];
  vector<long long> par(n + 1, 0);
  for (i = 2; i <= n; i++) {
    cin >> k;
    par[i] = k;
    adj[k].push_back(i);
  }
  vector<long long> level(n + 1, 0);
  level[1] = 0;
  queue<long long> q;
  q.push(1);
  vector<bool> vis;
  long long maxim = INT_MIN;
  while (!q.empty()) {
    long long u = q.front();
    q.pop();
    for (j = 0; j < adj[u].size(); j++) {
      level[adj[u][j]] = level[u] + 1;
      maxim = max(level[u] + 1, maxim);
      q.push(adj[u][j]);
    }
  }
  vector<long long> maxiy[maxim + 1];
  for (j = 1; j <= n; j++) {
    k = level[j];
    maxiy[k].push_back(j);
  }
  vector<long long> ans(maxim + 1, 1);
  k = 0;
  for (j = maxim; j >= 0; j--) {
    k += maxiy[j].size() % 2;
  }
  cout << k << endl;
  return 0;
}
