#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 10;
const long long mod = 1e9 + 7;
vector<long long> adj[N];
vector<long long> vis(N);
long long ans;
int32_t main() {
  long long n;
  cin >> n;
  vector<long long> nodel(n + 1);
  for (long long i = 2; i <= n; i++) {
    long long x;
    cin >> x;
    adj[x].push_back(i);
  }
  queue<long long> qt;
  qt.push(1);
  long long level = 2;
  nodel[1] = 1;
  qt.push(-1);
  while (!qt.empty()) {
    long long x = qt.front();
    if (x == -1) {
      qt.pop();
      if (qt.empty()) break;
      level++;
      qt.push(-1);
    }
    x = qt.front();
    qt.pop();
    for (auto i : adj[x]) {
      if (!vis[i]) {
        vis[i] = 1;
        nodel[level]++;
        qt.push(i);
      }
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++)
    if (nodel[i] & 1) ans++;
  cout << ans;
  return 0;
}
