#include <bits/stdc++.h>
using namespace std;
int N, level[100001], max_level = -1;
vector<int> graph[100001];
void DFS(int source, int current_level) {
  level[current_level]++;
  max_level = (max_level >= current_level ? max_level : current_level);
  for (int i = 0; i < graph[source].size(); i++) {
    DFS(graph[source][i], current_level + 1);
  }
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  for (int i = 2; i <= N; i++) {
    int parent;
    cin >> parent;
    graph[parent].push_back(i);
  }
  long long int ans = 1;
  DFS(1, 0);
  for (int i = 1; i <= max_level; i++) {
    if (level[i] % 2) ans++;
  }
  cout << ans << endl;
  return 0;
}
