#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
int cnt[N];
vector<int> graf[N];
void dfs(int node, int dad, int dep) {
  cnt[dep]++;
  for (auto it : graf[node]) {
    if (it != dad) dfs(it, node, dep + 1);
  }
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    graf[x].push_back(i);
  }
  dfs(1, 0, 0);
  int sol = 0;
  for (int i = 0; i < N; i++) sol += cnt[i] % 2;
  cout << sol << endl;
  return 0;
}
