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