#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 1e9 + 7;
const int N = 5e5 + 7;
const int M = 5e6 + 7;
int p[N], dep[N], cnt[N];
signed main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  cnt[1] = 1;
  dep[1] = 1;
  for (int i = 2; i <= n; i++) {
    cin >> p[i];
    dep[i] = dep[p[i]] + 1;
    cnt[dep[i]]++;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (cnt[i] & 1) ans++;
  cout << ans << " ";
}
