#include <bits/stdc++.h>
using namespace std;
int ar[1000004], n, cnt[1000005], pre[100005], vis[100005], sum, a;
vector<int> vec[100005];
int main() {
  while (cin >> n) {
    sum = 0;
    memset(cnt, 0, sizeof cnt);
    for (int i = 2; i <= n; i++) {
      cin >> a;
      vec[i].push_back(a);
      vec[a].push_back(i);
    }
    vec[0].push_back(1);
    vec[1].push_back(0);
    queue<int> q;
    memset(vis, -1, sizeof vis);
    vis[0] = 0;
    q.push(0);
    while (!q.empty()) {
      int f = q.front();
      q.pop();
      for (int i = 0; i < vec[f].size(); i++) {
        int v = vec[f][i];
        if (vis[v] == -1) vis[v] = vis[f] + 1, q.push(v);
      }
    }
    for (int i = 1; i <= 100000; i++) cnt[vis[i]]++;
    for (int i = 1; i <= 100000; i++) {
      if (cnt[i] % 2 == 1) sum++;
    }
    cout << sum << endl;
    for (int i = 0; i <= 100000; i++) vec[i].clear();
  }
  return 0;
}
