#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int sz = 100070;
int p[sz];
int dist[sz];
int dfs(int v) {
  if (dist[v] == -1) {
    dist[v] = dfs(p[v]) + 1;
  }
  return dist[v];
}
int ans[sz];
int main() {
  ios::sync_with_stdio(false);
  memset(dist, -1, sizeof(dist));
  int n;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> p[i];
    --p[i];
  }
  dist[0] = 0;
  for (int i = 0; i < n; ++i) dfs(i);
  memset(ans, 0, sizeof(ans));
  for (int i = 0; i < n; ++i) ans[dist[i]] ^= 1;
  int total = 0;
  for (int i = 0; i < n; ++i) total += ans[i];
  cout << total << endl;
  return 0;
}
