#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> adj[n + 1];
  long long temp;
  for (long long i = 2; i < n + 1; i++) {
    cin >> temp;
    adj[i].push_back(temp);
    adj[temp].push_back(i);
  }
  vector<long long> level(100005, 0), sumer(100005, 0), color(100005, 0);
  level[1] = 0;
  sumer[0]++;
  queue<long long> q;
  q.push(1);
  while (!q.empty()) {
    long long x = q.front();
    q.pop();
    color[x] = 1;
    for (long long i = 0; i < adj[x].size(); i++) {
      if (color[adj[x][i]] == 0) {
        q.push(adj[x][i]);
        level[adj[x][i]] = level[x] + 1;
        sumer[level[adj[x][i]]]++;
      }
    }
    color[x] = 2;
  }
  long long ans = 0;
  for (long long i = 0; i < 100005; i++) ans += (sumer[i] % 2);
  cout << ans;
  return 0;
}
