#include <bits/stdc++.h>
using namespace std;
int a[100005];
void dfs(int v, vector<vector<int> >& tree, int time) {
  a[time]++;
  for (int i = 0; i < tree[v].size(); i++) {
    dfs(tree[v][i], tree, time + 1);
  }
}
int main(void) {
  int n;
  cin >> n;
  vector<vector<int> > tree(n);
  for (int i = 1; i < n; i++) {
    int a1;
    cin >> a1;
    a1--;
    tree[a1].push_back(i);
  }
  memset(a, 0, sizeof(a));
  dfs(0, tree, 1);
  int count = 0;
  for (int i = 1; i <= n; i++) {
    count += a[i] % 2;
  }
  cout << count << endl;
}
