#include <bits/stdc++.h>
using namespace std;
int sum = 1, maxlvl = 0;
multimap<int, int> m;
vector<vector<int> > v(100005);
void fun(int a, int lvl) {
  v[lvl].push_back(a);
  int i, ct, sum1 = 0;
  multimap<int, int>::iterator p;
  ct = m.count(a);
  for (i = 0; i < ct; i++) {
    p = m.lower_bound(a);
    fun(p->second, lvl + 1);
    m.erase(p);
  }
  if (lvl > maxlvl) maxlvl = lvl;
}
int main() {
  int sum1 = 0, n, i, j, c;
  cin >> n;
  for (i = 0; i < n - 1; i++) {
    cin >> c;
    m.insert(pair<int, int>(c, i + 2));
  }
  multimap<int, int>::iterator p = m.begin();
  multimap<int, int> map;
  for (i = 0; i < n - 1; i++) {
    map.insert(pair<int, int>(p->first, p->second));
    p++;
  }
  fun(1, 0);
  for (i = 0; i <= maxlvl; i++) {
    sum1 = 0;
    for (j = 0; j < v[i].size(); j++) {
      sum1 = (sum1 + map.count(v[i][j])) % 2;
    }
    sum = sum + sum1;
  }
  cout << sum;
}
