#include <bits/stdc++.h>
using namespace std;
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n;
  cin >> n;
  vector<long long> a(n + 1);
  for (long long i = (2); i < (n + 1); ++i) cin >> a[i];
  vector<vector<long long> > v(n + 1);
  for (long long i = (2); i < (n + 1); ++i) {
    v[a[i]].push_back(i);
  }
  deque<pair<int, int> > q;
  q.push_back({1, 0});
  unordered_map<int, int> cnt;
  while (!q.empty()) {
    pair<int, int> nd = q.front();
    q.pop_front();
    cnt[nd.second]++;
    for (auto i : v[nd.first]) {
      q.push_back({i, nd.second + 1});
    }
  }
  long long ans = 0;
  for (auto i : cnt) {
    ans += i.second % 2;
  }
  cout << ans;
}
