#include <bits/stdc++.h>
using namespace std;
vector<int> con[100005];
int coun[100005];
void serc(int x, int l) {
  coun[l]++;
  for (int i = 0; i < con[x].size(); i++) {
    serc(con[x][i], l + 1);
  }
  return;
}
int main() {
  int n;
  cin >> n;
  int a;
  for (int i = 2; i <= n; i++) {
    cin >> a;
    con[a].push_back(i);
  }
  serc(1, 1);
  int k = 0;
  for (int i = 1; i <= n; i++) {
    k += coun[i] % 2;
  }
  printf("%d\n", k);
}
