#include <bits/stdc++.h>
using namespace std;
int inf = 1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  vector<vector<int> > g(n);
  for (int i = 0; i < n - 1; i++) {
    int cur;
    cin >> cur;
    cur--;
    g[i + 1].push_back(cur);
    g[cur].push_back(i + 1);
  }
  int res = 1;
  vector<int> used(n);
  used[0] = 1;
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int curres = 0;
    queue<int> q2;
    while (!q.empty()) {
      int cur = q.front();
      q.pop();
      for (auto it : g[cur]) {
        if (used[it] != 1) {
          q2.push(it);
          used[it] = 1;
          curres++;
        }
      }
    }
    res += curres % 2;
    swap(q2, q);
  }
  cout << res;
  return 0;
}
