#include <bits/stdc++.h>
using namespace std;
const int cap = int(1e5) + 1;
vector<int> graph[cap];
vector<int> cnt(cap);
void dfs(int i, int h) {
  cnt[h] ^= 1;
  for (int j : graph[i]) dfs(j, h + 1);
}
int main() {
  int n;
  cin >> n;
  int p;
  for (int i = 2; i <= n; ++i) {
    cin >> p;
    graph[p].push_back(i);
  }
  dfs(1, 0);
  int ans = 0;
  for (int i = 0; i < n; ++i) ans += cnt[i];
  cout << ans;
  return 0;
}
