#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, a, mx = 0, ans = 1;
  int fl[111111] = {0};
  int cnt[111111] = {0};
  cin >> n;
  for (i = 1; i < n; i++) {
    cin >> a;
    fl[i] = fl[a - 1] + 1;
    mx = max(mx, fl[i]);
    cnt[fl[i]]++;
  }
  for (i = 1; i <= mx; i++) {
    ans += cnt[i] & 1;
  }
  cout << ans;
  return 0;
}
