#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> children;
vector<int> levels;
void dfs(int v, int level) {
  levels[level] += 1;
  for (auto &c : children[v]) {
    dfs(c, level + 1);
  }
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  children.resize(n);
  levels.resize(n);
  for (int i = 1; i < n; i++) {
    int a;
    cin >> a;
    children[a - 1].push_back(i);
  }
  dfs(0, 0);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += levels[i] % 2;
  }
  cout << sum << endl;
}
