#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
int n;
int fa[N];
int dp[N], cnt = 0, now[N];
int dps(int u) {
  if (u == 1 || dp[u]) return dp[u];
  return dp[u] = dps(fa[u]) + 1;
}
int main() {
  cin >> n;
  memset(dp, 0, sizeof(dp));
  memset(now, 0, sizeof(now));
  for (int i = 2; i <= n; i++) scanf("%d", &fa[i]);
  for (int i = 1; i <= n; i++) now[dps(i)] ^= 1;
  for (int i = 0; i < n; i++)
    if (now[i]) cnt++;
  cout << cnt;
  return 0;
}
