#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 2e5;
int dep[N], fa[N], cnt[N], ans;
int main() {
  ios ::sync_with_stdio(0);
  cin >> n;
  ans = 1;
  for (int i = 2; i <= n; ++i) {
    cin >> fa[i];
    dep[i] = dep[fa[i]] + 1;
    cnt[dep[i]] ^= 1;
  }
  for (int i = 1; i <= n; ++i) ans += cnt[i];
  cout << ans << endl;
}
