#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> x(100001);
int cnt[100001] = {0};
int dfs(int i, int t) {
  cnt[t]++;
  if (x[i].size() == 0) return 1;
  int l, ml = 1;
  for (int j = 0; j < x[i].size(); j++) {
    l = 1 + dfs(x[i][j], t + 1);
    if (l > ml) ml = l;
  }
  return ml;
}
int main() {
  int n, i, u;
  cin >> n;
  for (i = 2; i <= n; i++) {
    cin >> u;
    x[u].push_back(i);
  }
  int len = dfs(1, 0);
  int ans = 0;
  for (i = 0; i < len; i++) {
    ans = ans + (cnt[i] % 2);
  }
  cout << ans;
  return 0;
}
