#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> edge[100050];
int bfs() {
  queue<int> q;
  int sz = 0;
  int cnt = 0;
  q.push(1);
  while (!q.empty()) {
    if (sz == 0) {
      if (q.size() % 2) cnt++;
      sz = q.size();
    }
    int p = q.front();
    q.pop();
    sz--;
    for (int e : edge[p]) {
      q.push(e);
    }
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int v;
    cin >> v;
    edge[v].push_back(i);
  }
  cout << bfs();
}
