#include <bits/stdc++.h>
using namespace std;
vector<set<int> > v;
vector<vector<int> > g;
int dist[500005];
int main() {
  int n, x;
  cin >> n;
  v.assign(n + 5, set<int>());
  g.assign(n + 5, vector<int>());
  for (int i = 1; i < n; ++i) {
    cin >> x;
    x--;
    g[x].push_back(i);
  }
  queue<int> q;
  set<int> ans;
  q.push(0);
  ans.insert(0);
  while (!q.empty()) {
    int s = q.front();
    q.pop();
    for (auto it : g[s]) {
      if (!dist[it]) {
        dist[it] = dist[s] + 1;
        if (ans.count(dist[it])) {
          ans.erase(dist[it]);
        } else {
          ans.insert(dist[it]);
        }
        q.push(it);
      }
    }
  }
  cout << ans.size() << '\n';
}
