#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int n, d[MAXN] = {0};
vector<int> a[MAXN];
void dfs(int u, int depth) {
  d[depth] ^= 1;
  for (int v : a[u]) dfs(v, depth + 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 2, x; i <= n; ++i) {
    scanf("%d", &x);
    a[x].push_back(i);
  }
  dfs(1, 1);
  int ans = 0;
  for (int i = 1; i <= n; ++i) ans += d[i];
  printf("%d\n", ans);
  return 0;
}
