#include <bits/stdc++.h>
using namespace std;
vector<bool> visited;
vector<vector<int> > graph;
int n, m;
queue<int> q;
vector<int> dist;
void bfs(int start) {
  visited[start] = true;
  q.push(start);
  while (q.size() != 0) {
    for (int i = 0; i < graph[q.front()].size(); i++) {
      if (visited[graph[q.front()][i]] == false) {
        q.push(graph[q.front()][i]);
        visited[graph[q.front()][i]] = true;
        dist[graph[q.front()][i]] = dist[q.front()] + 1;
      }
    }
    q.pop();
  }
}
int main() {
  cin >> n;
  visited.resize(n, false);
  dist.resize(n, 0);
  graph.resize(n);
  for (int i = 1; i < n; i++) {
    int a;
    cin >> a;
    graph[a - 1].push_back(i);
  }
  bfs(0);
  for (int i = 0; i < graph[0].size(); i++) {
  }
  for (int i = 0; i < n; i++) {
  }
  priority_queue<int> dq;
  for (int i = 0; i < n; i++) {
    dq.push(dist[i]);
  }
  vector<int> howmany;
  int a = -1;
  int count1 = 1;
  int totalcount = 0;
  while (dq.size() != 0) {
    if (dq.top() == a) {
      count1 += 1;
    } else {
      totalcount = totalcount + count1 % 2;
      a = dq.top();
      count1 = 1;
    }
    dq.pop();
  }
  cout << totalcount;
}
