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