#include <bits/stdc++.h>
using namespace std;
const long long prime = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, p, maxrank = 1, rank[100005] = {0}, rankcnt[100005] = {0},
                  sum = 0;
  cin >> n;
  rank[1] = 1, rankcnt[1] = 1;
  for (long long i = (long long)(2); i <= (long long)(n); i++) {
    cin >> p;
    rank[i] = rank[p] + 1;
    maxrank = max(maxrank, rank[i]);
    rankcnt[rank[i]] = 1 - rankcnt[rank[i]];
  }
  for (long long i = (long long)(1); i <= (long long)(maxrank); i++) {
    sum += rankcnt[i];
  }
  cout << sum;
}
