#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cin.sync_with_stdio(0);
  int n;
  cin >> n;
  vector<vector<int> > p(n);
  for (int i = 1; i < n; i++) {
    int tmp;
    cin >> tmp;
    p[tmp - 1].push_back(i);
  }
  int ans = 0;
  queue<pair<int, int> > q;
  q.push(pair<int, int>(0, 0));
  vector<int> tmp(n, 0);
  while (q.size()) {
    pair<int, int> front = q.front();
    int cur = front.first;
    int level = front.second;
    q.pop();
    tmp[level] = !tmp[level];
    for (auto it : p[cur]) q.push(pair<int, int>(it, level + 1));
  }
  for (int i = 0; i < n; i++) ans += tmp[i];
  cout << ans << endl;
  return 0;
}
