#include <bits/stdc++.h>
using namespace std;
long long n, i, cnt[200005], p[200005], s[2000005];
queue<long long> q;
bool viz[200005];
vector<long long> v[200005];
map<long long, long long> m;
void bfs(long long nod) {
  viz[nod] = 1;
  cnt[nod] = 0;
  q.push(nod);
  while (q.size()) {
    long long s = q.front();
    q.pop();
    for (auto x : v[s]) {
      if (viz[x]) continue;
      cnt[x] = cnt[s] + 1;
      viz[x] = true;
      q.push(s);
      m[cnt[x]]++;
    }
  }
}
int main() {
  cin >> n;
  s[0]++;
  for (i = 2; i <= n; i++) {
    cin >> p[i];
    cnt[i] = cnt[p[i]] + 1;
    s[cnt[i]]++;
  }
  long long ans = 0;
  for (i = 0; i <= n - 1; i++) ans += s[i] % 2;
  cout << ans;
  return 0;
}
