#include <bits/stdc++.h>
using namespace std;
const int M = 111111;
int Tit[M];
int ra[M];
int k[M];
int r, j, rslt = 0;
vector<int> vec[M];
void dfs(int u, int v) {
  ra[u] = ra[v] + 1;
  k[ra[u]] ^= 1;
  int j = vec[u].size();
  int z;
  while (j--) {
    z = vec[u][j];
    if (z != v) dfs(z, u);
  }
}
int main() {
  scanf("%d", &r);
  for (j = 2; j <= r; j = j + 1) scanf("%d", Tit + j), vec[Tit[j]].push_back(j);
  dfs(1, 0);
  for (j = 1; j <= r; j = j + 1) rslt += k[j];
  cout << rslt;
  return 0;
}
