#include <bits/stdc++.h>
using namespace std;
struct node {
  int fa, co;
  node(int fa = 0, int co = 0) : fa(fa), co(co) {}
} tree[100000 + 1];
int dis[100000 + 1];
int main() {
  int n, ans = 1, f;
  tree[1] = node(0, 0);
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &f);
    tree[i] = node(f, tree[f].co + 1);
    dis[tree[i].co]++;
  }
  for (int i = 1; dis[i] != 0; i++) {
    if (dis[i] % 2 == 1) {
      ans++;
    }
  }
  printf("%d", ans);
  return 0;
}
