#include <bits/stdc++.h>
const int N = 100001;
bool visited[N];
int level[N];
int levelFreq[N];
std::vector<int> adjList[N];
void BFS(int v) {
  std::queue<int> q;
  q.push(v);
  visited[v] = true;
  level[v] = 1;
  ++levelFreq[level[v]];
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = 0; i < adjList[x].size(); ++i) {
      if (!visited[adjList[x][i]]) {
        q.push(adjList[x][i]);
        visited[adjList[x][i]] = true;
        level[adjList[x][i]] = level[x] + 1;
        ++levelFreq[level[x] + 1];
      }
    }
  }
}
int main() {
  int n;
  std::cin >> n;
  for (int i = 2; i <= n; ++i) {
    int p;
    std::cin >> p;
    adjList[p].push_back(i);
  }
  for (int i = 1; i <= n; ++i) {
    if (!visited[i]) BFS(i);
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) ans += (levelFreq[i] % 2);
  std::cout << ans;
}
