#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 28;
vector<int> graph[100005];
int levelCounter[100005] = {0}, visited[100005], dist[100005];
void bfs(int source) {
  dist[source] = 0;
  memset(visited, 0, sizeof(visited));
  visited[source] = 1;
  queue<int> q;
  q.push(source);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < graph[u].size(); i++) {
      int v = graph[u][i];
      if (!visited[v]) {
        visited[v] = 1;
        dist[v] = dist[u] + 1;
        levelCounter[dist[v]]++;
        q.push(v);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, v;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> v;
    graph[v].push_back(i);
    graph[i].push_back(v);
  }
  for (int i = 0; i < 100005; i++) dist[i] = inf;
  bfs(1);
  int sum = 0;
  for (int i = 1; i < 100005; i++) {
    if (levelCounter[i] % 2 != 0) sum++;
  }
  cout << sum + 1 << endl;
  return 0;
}
