#include <bits/stdc++.h>
using namespace std;
inline void prep() {
  cin.tie(0);
  cin.sync_with_stdio(0);
}
int cnt[100005];
int main() {
  int n;
  cin >> n;
  vector<int> v(n + 1, 0);
  vector<int> dp = v;
  set<int> st;
  int ansr = 1;
  for (int i = 2; i <= n; i++) cin >> v[i];
  if (n <= 2) {
    cout << n;
    return 0;
  }
  dp[0] = 0, dp[1] = 0, dp[2] = 1;
  for (int i = 3; i <= n; ++i) dp[i] = dp[v[i]] + 1;
  for (int i = 2; i <= n; ++i) {
    cnt[dp[i]]++;
  }
  for (int i = 1; i <= n; i++) ansr += (cnt[i] % 2);
  cout << ansr;
}
