#include <bits/stdc++.h>
using namespace std;
const int max_N = 1e5 + 10;
int p[max_N];
int d[max_N];
int nodes[max_N];
vector<int> childs[max_N];
void dfs(int node);
int main() {
  int N;
  cin >> N;
  for (int i = 2; i <= N; ++i) {
    cin >> p[i];
    childs[p[i]].push_back(i);
  }
  dfs(1);
  for (int i = 1; i <= N; ++i) {
    nodes[d[i]]++;
  }
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    ans += nodes[i] % 2;
  }
  cout << ans << endl;
}
void dfs(int node) {
  for (auto& v : childs[node]) {
    d[v] = d[node] + 1;
    dfs(v);
  }
}
