#include <bits/stdc++.h>
using namespace std;
vector<int> g[100005];
int cnt[100005] = {0};
int vis[100005] = {0};
void dfs(int v, int step) {
  vis[v] = 1;
  cnt[step]++;
  for (int i = 0; i < g[v].size(); i++) {
    if (!vis[g[v][i]]) dfs(g[v][i], step + 1);
  }
  return;
}
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int u;
    scanf("%d", &u);
    g[u].push_back(i);
  }
  dfs(1, 1);
  for (int i = 1; i <= n; i++)
    if (cnt[i] & 1) ans++;
  printf("%d\n", ans);
  return 0;
}
