#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<int> depths(n);
  std::unordered_map<int, int> depthCounts;
  depths[0] = 0;
  depthCounts[0] = 1;
  for (int i = 1; i < n; ++i) {
    int temp;
    std::cin >> temp;
    int nextBranch = temp - 1;
    depths[i] = depths[nextBranch] + 1;
    if (depthCounts.end() == depthCounts.find(depths[i])) {
      depthCounts[depths[i]] = 1;
    } else {
      ++depthCounts[depths[i]];
    }
  }
  int result = 0;
  for (auto& depthCount : depthCounts) {
    if (depthCount.second % 2) {
      ++result;
    }
  }
  std::cout << result;
  return 0;
}
