#include <bits/stdc++.h>
using namespace std;
int n;
int p[100005];
vector<int> ch[100005];
int d[100005];
int amt[100005];
void dfs(int cn) {
  for (auto nn : ch[cn]) {
    d[nn] = d[cn] + 1;
    amt[d[nn]]++;
    dfs(nn);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = (2); i <= (signed)(n); i++) {
    cin >> p[i];
    ch[p[i]].push_back(i);
  }
  amt[0] = 1;
  dfs(1);
  int cnt = 0;
  for (int i = 0; i < (signed)(n); i++) {
    if (amt[i] % 2 == 1) {
      ++cnt;
    }
  }
  cout << cnt << "\n";
  return 0;
}
