#include <bits/stdc++.h>
using namespace std;
long long fact(long long n) {
  if (n == 0 || n == 1)
    return 1;
  else
    return n * fact(n - 1);
}
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (a == 1 || b == 1)
    return 1;
  else if (a == 0)
    return b;
  else if (b == 0)
    return a;
  else {
    long long r = a > b ? a % b : b % a;
    if (r == 0)
      return min(a, b);
    else
      return gcd(min(a, b), r);
  }
}
bool Comparator(int a, int b) { return (a >= b); }
long long M = 1e9 + 7;
long long solve() {
  int n;
  cin >> n;
  vector<int> inf(n, 0), tt(n, 0), ans(n, 0);
  for (long long i = 1; i < n; i++) {
    cin >> inf[i];
    inf[i]--;
  }
  tt[1] = 1;
  for (long long i = 2; i < n; i++) {
    tt[i] = tt[inf[i]] + 1;
  }
  for (long long i = 0; i < n; i++) {
    ans[tt[i]]++;
  }
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    sum += ans[i] % 2;
  }
  return sum;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    cout << solve() << "\n";
  }
  return 0;
}
