#include <bits/stdc++.h>
using namespace std;
const int MAX = 100100;
vector<int> adl[MAX];
int dist[MAX], n, ans;
void dfs(int vtx, int dst) {
  dist[dst]++;
  for (auto it : adl[vtx]) dfs(it, dst + 1);
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    adl[p].push_back(i);
  }
  dfs(1, 0);
  for (int i = 0; i < MAX; i++) ans += dist[i] % 2;
  cout << ans << endl;
  return 0;
}
