#include <bits/stdc++.h>
using namespace std;
int n, d[100001], b[100001], x, ans = 0;
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d", &x);
    d[i] = d[--x] + 1;
    b[d[i]]++;
  }
  for (int i = 1; i < n; i++) ans += b[i] % 2;
  printf("%d", ans + 1);
  return 0;
}
