#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> g[N];
bool visited[N];
int arr[N];
int main() {
  ios_base::sync_with_stdio(), cout.tie(NULL), cin.tie(NULL);
  ;
  memset(visited, false, sizeof(visited));
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> arr[i];
    g[arr[i]].push_back(i);
    g[i].push_back(arr[i]);
  }
  queue<int> q;
  q.push(1);
  visited[1] = true;
  int ans = 0;
  int parent = -1;
  while (!q.empty()) {
    int sz = q.size();
    ans += sz % 2;
    parent = q.front();
    while (sz--) {
      int x = q.front();
      q.pop();
      for (auto a : g[x]) {
        if (!visited[a]) {
          q.push(a);
          visited[a] = true;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
