#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 1e5 + 100;
int deep[N], sum[N];
int main() {
  int n;
  while (scanf("%d", &n) != EOF && n) {
    memset(sum, 0, sizeof(sum));
    memset(deep, 0, sizeof(deep));
    deep[1] = sum[1] = 1;
    for (int i = 2; i <= n; i++) {
      int x;
      scanf("%d", &x);
      deep[i] = deep[x] + 1;
      sum[deep[i]]++;
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) ans += sum[i] & 1;
    cout << ans << endl;
  }
  return 0;
}
