#include <bits/stdc++.h>
using namespace std;
int lp[1000000 + 5];
void seive() {
  long long i, j;
  for (i = 2; i <= sqrt(1000000); i++) {
    if (!lp[i]) {
      for (j = i * i; j <= 1000000; j += i)
        if (lp[j] == 0) lp[j] = i;
    }
  }
}
vector<int> adj[100000 + 5];
int n;
int level[100000 + 5], mark[100000 + 5];
map<int, int> mpp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int i, x, ans = 0;
  for (i = 0; i < n - 1; i++) {
    cin >> x;
    adj[x].push_back(i + 2);
    adj[i + 2].push_back(x);
  }
  queue<int> q;
  q.push(1);
  level[1] = 0;
  mark[1] = 1;
  while (!q.empty()) {
    x = q.front();
    q.pop();
    for (i = 0; i < (int)adj[x].size(); i++) {
      if (!mark[adj[x][i]]) {
        mark[adj[x][i]] = 1;
        level[adj[x][i]] = 1 + level[x];
        q.push(adj[x][i]);
      }
    }
  }
  for (i = 1; i <= n; i++) {
    mpp[level[i]]++;
  }
  for (__typeof(mpp.begin()) it = mpp.begin(); it != mpp.end(); it++) {
    ans += it->second & 1;
  }
  cout << ans << "\n";
  return 0;
}
