#include <bits/stdc++.h>
using namespace std;
struct tree {
  int to, next;
} e[100010];
int size, n, dep[100010], num[100010], head[100010];
void add(int x, int y) {
  size++;
  e[size].to = y;
  e[size].next = head[x];
  head[x] = size;
}
void dfs(int x, int fa) {
  dep[x] = dep[fa] + 1;
  num[dep[x]]++;
  for (int i = head[x]; i; i = e[i].next) {
    int y = e[i].to;
    dfs(y, x);
  }
}
int main() {
  scanf("%d", &n);
  for (int x, i = 2; i <= n; i++) scanf("%d", &x), add(x, i);
  dfs(1, 0);
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (num[i] & 1) ans++;
  printf("%d", ans);
}
