#include <bits/stdc++.h>
using namespace std;
int root;
vector<int> graph[100001];
vector<int> depth(100001, 0);
void dfs(int u, int height) {
  depth[height]++;
  for (int v : graph[u]) {
    dfs(v, height + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int fall;
  for (int i = 2; i <= n; i++) {
    cin >> fall;
    graph[fall].push_back(i);
  }
  dfs(1, 0);
  int res = 0;
  for (int i = 0; i < 100001; i++) {
    if (depth[i] % 2) {
      res++;
    }
  }
  cout << res;
}
