#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, k, l, p;
  scanf("%d", &n);
  int z[100001] = {};
  z[1] = 0;
  int e[100001] = {};
  for (i = 2; i <= n; i++) {
    scanf("%d", &l);
    z[i] = z[l] + 1;
    e[z[i]]++;
  }
  int res = 0;
  for (int i = 1; i <= n; i++) res += e[i] % 2;
  printf("%d", res + 1);
  return 0;
}
