#include <bits/stdc++.h>
using namespace std;
int n, p[100100], deep[100100], kol[100100];
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) cin >> p[i];
  deep[1] = 0;
  for (int i = 2; i <= n; i++) deep[i] = deep[p[i]] + 1;
  for (int i = 2; i <= n; i++) kol[deep[i]]++;
  int ans = 1;
  for (int i = 1; i <= n; i++) ans += kol[i] % 2;
  cout << ans;
  return 0;
}
