#include <bits/stdc++.h>
using namespace std;
long long i, j, k, n;
const long long N = 1e5 + 5;
map<long long, long long> l;
vector<long long> adj[N];
vector<long long> vis(N);
map<long long, long long> mp;
void dfs(long long n) {
  for (auto itr : adj[n]) {
    mp[itr] = mp[n] + 1;
    l[mp[n] + 1]++;
    dfs(itr);
  }
}
int32_t main() {
  long long n;
  cin >> n;
  for (i = 2; i <= n; i++) {
    long long a;
    cin >> a;
    adj[a].push_back(i);
  }
  mp[1] = 1;
  l[1] = 1;
  dfs(1);
  map<long long, long long> m;
  long long ans = 0;
  for (i = 1; i <= l.size(); i++) {
    if (l[i] % 2 == 1) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
