#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
map<int, int> h;
int main() {
  int n;
  cin >> n;
  m[1] = 0;
  h[0] = 1;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    m[i] = m[x] + 1;
    if (h.find(m[x] + 1) != h.end())
      h[m[x] + 1] += 1;
    else
      h[m[x] + 1] = 1;
  }
  int ans = 0;
  for (auto i : h) {
    if (i.second % 2 == 1) ans += 1;
  }
  cout << ans;
  return 0;
}
