#include <bits/stdc++.h>
using namespace std;
struct tree {
  queue<int> a;
};
tree num[100005];
long long apple[100005];
int beg = 1;
void dfs(int nn, int beg) {
  if (num[nn].a.empty()) return;
  while (!num[nn].a.empty()) {
    int n1 = num[nn].a.front();
    num[nn].a.pop();
    apple[beg + 1]++;
    dfs(n1, beg + 1);
  }
}
int main() {
  int number;
  cin >> number;
  int num1;
  memset(apple, 0, sizeof(apple));
  apple[1] = 1;
  for (int i = 2; i <= number; i++) {
    cin >> num1;
    num[num1].a.push(i);
  }
  long long ans = 0;
  dfs(1, beg);
  for (int i = 1; i <= number; i++) {
    if (apple[i] % 2 != 0) ans++;
  }
  cout << ans << endl;
  return 0;
}
