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