#include <bits/stdc++.h>
using namespace std;
vector<int> g[123456];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    g[p].push_back(i);
  }
  queue<int> q;
  q.push(1);
  int dist[123456];
  dist[1] = 0;
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (int v : g[u]) {
      dist[v] = dist[u] + 1;
      q.push(v);
    }
  }
  int ans = 0;
  map<int, int> mp;
  for (int i = 1; i <= n; i++) mp[dist[i]]++;
  for (auto e : mp) {
    if (e.second & 1) ans++;
  }
  cout << ans << '\n';
  return 0;
}
