#include <bits/stdc++.h>
using namespace std;
vector<long> s;
vector<long>::iterator it;
long visited[100002];
vector<long> adj[100002];
int main() {
  memset(visited, 0, sizeof(visited));
  long i, j, el, k, n;
  cin >> n;
  for (long int i = 2; i < n + 1; i++) {
    cin >> el;
    adj[el].push_back(i);
  }
  long ans = 0;
  s.push_back(1);
  i = 0;
  while (i < n) {
    k = s.size();
    ans += (k - i) % 2;
    for (; i < k; i++) {
      for (long int j = 0; j < adj[s[i]].size(); j++) {
        s.push_back(adj[s[i]][j]);
      }
    }
  }
  cout << ans << endl;
}
