#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
vector<int> adj[100010];
int sz[100010];
int a[100010];
void dfs(int i, int h) {
  a[h] ^= 1;
  for (auto j : adj[i]) {
    dfs(j, h + 1);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 2, par; i <= n; ++i) {
    cin >> par;
    adj[par].push_back(i);
  }
  dfs(1, 0);
  int ans = 0;
  for (int i = 0; i < 100010; ++i) {
    ans += a[i];
  }
  cout << ans << endl;
}
