#include <bits/stdc++.h>
using namespace std;
long long int lev[100005];
std::vector<int> v[100005];
bool mark[100005];
int cnt[100005];
long long int mx;
void bfs(int n) {
  mark[n] = true;
  lev[n] = 0;
  queue<int> q;
  q.push(n);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto x : v[u]) {
      if (mark[x] == false) {
        mark[x] = true;
        lev[x] = lev[u] + 1;
        mx = max(lev[x], mx);
        q.push(x);
        cnt[lev[x]]++;
      }
    }
  }
}
int main() {
  int n, ans = 0;
  mx = -100000000000014;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    long long int x;
    cin >> x;
    v[i].push_back(x);
    v[x].push_back(i);
  }
  bfs(1);
  for (int i = 1; i <= mx; i++) {
    if (cnt[i] % 2) ans++;
  }
  cout << ans + 1 << endl;
  return 0;
}
