#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> sons[100000];
int num_of_vertices_on_depth[100000];
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int dad;
    cin >> dad;
    sons[dad - 1].push_back(i);
  }
  queue<pair<int, int>> que;
  que.emplace(0, 0);
  while (!que.empty()) {
    const pair<int, int> p = move(que.front());
    que.pop();
    num_of_vertices_on_depth[p.second]++;
    for (int s : sons[p.first]) que.emplace(s, p.second + 1);
  }
  int ans = 0;
  for (int i = 0; i < n; ++i)
    if (num_of_vertices_on_depth[i] % 2 == 1) ans++;
  cout << ans << endl;
  return 0;
}
