#include <bits/stdc++.h>
using namespace std;
const int N = 1000001;
int n, p[N], d[N], c[N], ans;
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &p[i]);
  }
  for (int i = 1; i <= n; i++) {
    d[i] = d[p[i]] + 1;
    c[d[i]]++;
  }
  for (int i = 1; i <= n; i++) ans += (c[i] & 1);
  cout << ans;
  return 0;
}
