#include <bits/stdc++.h>
using namespace std;
const int N = 100000;
int n, cnt[N + 9];
struct side {
  int y, next;
} e[N * 2 + 9];
int lin[N + 9], cs;
void Ins(int x, int y) {
  e[++cs].y = y;
  e[cs].next = lin[x];
  lin[x] = cs;
}
void Ins2(int x, int y) {
  Ins(x, y);
  Ins(y, x);
}
void into() {
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    Ins(x, i);
  }
}
void Dfs_cnt(int k, int fa, int d) {
  cnt[d] ^= 1;
  for (int i = lin[k]; i; i = e[i].next) Dfs_cnt(e[i].y, k, d + 1);
}
int ans;
void work() {
  Dfs_cnt(1, 0, 1);
  for (int i = 1; i <= n; ++i) ans += cnt[i];
  printf("%d\n", ans);
}
void outo() {}
int main() {
  int T = 1;
  for (; T--;) {
    into();
    work();
    outo();
  }
  return 0;
}
