#include <bits/stdc++.h>
using namespace std;
vector<int> g[100001];
queue<pair<int, int> > qe;
int main() {
  int n, i, u, cnt, ret = 0, a, b;
  scanf("%d", &n);
  for (i = 2; i <= n; i++) {
    scanf("%d", &u);
    g[u].push_back(i);
  }
  qe.push(make_pair(1, 0));
  while (!qe.empty()) {
    a = qe.front().second;
    cnt = 0;
    while (!qe.empty() && qe.front().second == a) {
      cnt++;
      b = qe.front().first;
      qe.pop();
      for (i = 0; i < g[b].size(); i++) {
        qe.push(make_pair(g[b][i], a + 1));
      }
    }
    ret += cnt & 1;
  }
  printf("%d", ret);
  return 0;
}
