#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
int n, x, cnt, res;
int vis[1000000], vi[1000000];
int main() {
  cin >> n;
  vis[1] = 1;
  vi[1] = 1;
  for (int i = 2; i <= n; i++) {
    cin >> x;
    vis[i] = vis[x] + 1;
    vi[vis[i]]++;
  }
  for (int i = 1; i <= n; i++) res += vi[i] % 2;
  cout << res;
  return 0;
}
