#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> graph;
vector<int> level;
void dfs(int v, int depth = 0) {
  level[depth] ^= 1;
  for (int u : graph[v]) dfs(u, depth + 1);
}
int main() {
  int n;
  cin >> n;
  graph.resize(n);
  for (int i = 1; i < n; ++i) {
    int x;
    cin >> x;
    graph[--x].push_back(i);
  }
  level.resize(n, 0);
  dfs(0);
  int ans = 0;
  for (int i = 0; i < n; ++i) ans += level[i];
  cout << ans;
  return 0;
}
