#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> Graph[n + 1];
  for (long long i = 2; i <= n; i++) {
    long long a;
    cin >> a;
    Graph[i].push_back(a);
    Graph[a].push_back(i);
  }
  long long tot = 1;
  queue<long long> arbre;
  arbre.push(1);
  vector<bool> visited(n + 1, false);
  visited[1] = true;
  long long nb = 1;
  long long next = 0;
  while (!arbre.empty()) {
    nb--;
    long long curr = arbre.front();
    arbre.pop();
    for (long long adj : Graph[curr]) {
      if (!visited[adj]) {
        visited[adj] = true;
        arbre.push(adj);
        next++;
      }
    }
    if (nb == 0) {
      nb = next;
      tot += next % 2;
      next = 0;
    }
  }
  cout << tot << endl;
}
