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