#include <bits/stdc++.h>
using namespace std;
inline int rd() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int dep[100005], sum[100005], p[100005];
int main() {
  int n = rd();
  dep[1] = 1;
  sum[1]++;
  for (int i = 2; i <= n; i++) {
    p[i] = rd();
    dep[i] = dep[p[i]] + 1;
    sum[dep[i]]++;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += (sum[i] % 2);
  cout << ans;
}
