#include <bits/stdc++.h>
using namespace std;
int n;
int depn[100002];
struct node {
  stack<int> s;
  bool visit = false;
} d[100002];
void dfs(int v, int dep) {
  if (d[v].visit) return;
  d[v].visit = true;
  depn[dep]++;
  while (!d[v].s.empty()) {
    int tmp = d[v].s.top();
    d[v].s.pop();
    dfs(tmp, dep + 1);
  }
  return;
}
int main() {
  int i, x, ans = 0;
  memset(depn, 0, sizeof(depn));
  scanf("%d", &n);
  for (i = 2; i <= n; i++) {
    scanf("%d", &x);
    d[x].s.push(i);
  }
  dfs(1, 0);
  for (i = 0; i <= n; i++) ans += depn[i] % 2;
  printf("%d\n", ans);
  return 0;
}
