#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
int n, i, p, ans, cnt[N];
vector<int> edges[N];
void dfs(int u = 1, int lvl = 0) {
  cnt[lvl]++;
  for (int v : edges[u]) {
    dfs(v, lvl + 1);
  }
}
int main() {
  scanf("%d", &n);
  for (i = 2; i <= n; ++i) {
    scanf("%d", &p);
    edges[p].push_back(i);
  }
  dfs();
  for (i = 0; i < N; ++i) {
    ans += (cnt[i] & 1);
  }
  cout << ans << endl;
  return 0;
}
