#include <bits/stdc++.h>
using namespace std;
char temp[1000005];
vector<int> graph[100005];
int level[100005];
void dfs(int v, int parent, int l) {
  level[l]++;
  for (int u : graph[v]) {
    if (u != parent) {
      dfs(u, v, l + 1);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int a;
    scanf("%d", &a);
    graph[a].push_back(i);
    graph[i].push_back(a);
  }
  dfs(1, 1, 1);
  int ans = 0;
  for (int i = 1; i < 100005; i++) {
    ans += level[i] % 2;
  }
  cout << ans << endl;
  return 0;
}
