#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > G;
vector<int> n_dist(1000000, 0);
int bfs() {
  vector<int> dist(G.size());
  queue<int> q;
  dist[0] = 0;
  q.push(0);
  while (!q.empty()) {
    int t = q.front();
    n_dist[dist[t]] = n_dist[dist[t]] ^ 1;
    q.pop();
    for (int i = 0; i < G[t].size(); i++) {
      q.push(G[t][i]);
      dist[G[t][i]] = dist[t] + 1;
    }
  }
  int sum = 0;
  for (int i = 0; i < n_dist.size(); i++) {
    sum += n_dist[i];
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  G.resize(n);
  for (int i = 0; i < n - 1; i++) {
    int num;
    cin >> num;
    G[num - 1].push_back(i + 1);
  }
  cout << bfs() << "\n";
}
