#include <bits/stdc++.h>
using namespace std;
int n, sbor = 1, p;
int a[100010];
int b[100010];
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> p;
    a[i] = a[--p] + 1;
    b[a[i]]++;
  }
  for (int i = 1; i < n; i++) sbor = sbor + b[i] % 2;
  cout << sbor << ' ';
}
