#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N], l[N];
int main() {
  int n, x, ans = 0;
  scanf("%d", &n);
  l[1] = 1;
  for (int i = 2; i <= n; i++) {
    scanf("%d", &x);
    l[i] = l[x] + 1;
  }
  for (int i = 1; i <= n; i++) {
    a[l[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    ans += a[i] & 1;
  }
  printf("%d", ans);
  return 0;
}
