#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, a[maxn], deep[maxn], head[maxn], to[maxn * 2], nextt[maxn * 2],
    tot = 1, ans[maxn], anss;
void add(int x, int y) {
  to[tot] = y;
  nextt[tot] = head[x];
  head[x] = tot++;
}
void dfs(int u, int fa) {
  deep[u] = deep[fa] + 1;
  ans[deep[u]]--;
  for (int i = head[u]; i; i = nextt[i]) {
    int v = to[i];
    if (v == fa) continue;
    dfs(v, u);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &a[i]);
    add(a[i], i);
  }
  dfs(1, 0);
  for (int i = 1; i <= n; i++)
    if (ans[i] & 1) anss++;
  printf("%d\n", anss);
  return 0;
}
