#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > grafo;
vector<int> dist;
map<int, int> m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  grafo.resize(t);
  for (int i = 0; i < t - 1; ++i) {
    int n;
    cin >> n;
    grafo[n - 1].push_back(i + 1);
  }
  queue<int> q;
  q.push(0);
  dist.assign(t, -1);
  dist[0] = 0;
  m[0]++;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < grafo[u].size(); i++) {
      int vec = grafo[u][i];
      if (dist[vec] == -1) {
        q.push(vec);
        dist[vec] = dist[u] + 1;
        m[dist[vec]]++;
      }
    }
  }
  map<int, int>::iterator it;
  int res = 0;
  for (it = m.begin(); it != m.end(); it++) {
    res += (it->second % 2);
  }
  cout << res << endl;
  return 0;
}
