#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
const int MAXN = 100024;
const int MOD = 1e9 + 7;
const double eps = 1e-8;
using namespace std;
vector<int> g[MAXN];
int n;
int b[MAXN], mcnt = 0;
void dfs(int v, int cnt) {
  mcnt = max(mcnt, cnt);
  b[cnt]++;
  for (auto to : g[v]) {
    dfs(to, cnt + 1);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int a;
    scanf("%d", &a);
    g[a].push_back(i);
  }
  dfs(1, 1);
  int ans = 0;
  for (int i = 1; i <= mcnt; i++) {
    if (b[i] % 2) ans++;
  }
  printf("%d", ans);
  return 0;
}
