#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n - 1];
  for (long long i = 0; i < n - 1; i++) {
    cin >> a[i];
  }
  long long b[n + 1];
  b[2] = 1;
  b[0] = 0;
  b[1] = 0;
  for (long long i = 3; i < n + 1; i++) {
    b[i] = b[a[i - 2]] + 1;
  }
  long long c[100001];
  for (long long i = 0; i < 100001; i++) {
    c[i] = 0;
  }
  for (long long i = 2; i < n + 1; i++) {
    c[b[i]]++;
  }
  long long count = 1;
  for (long long i = 1; i < 100001; i++) {
    if (c[i] % 2 == 1) {
      count++;
    }
  }
  cout << count << endl;
}
