#include <bits/stdc++.h>
using namespace std;
vector<int> arr[100100];
int dist[100100];
map<int, int> m1;
void dfs(int curr, int par) {
  dist[curr] = dist[par] + 1;
  if (curr == par) {
    dist[curr] = 0;
  }
  for (auto x : arr[curr]) {
    if (x != par) {
      dfs(x, curr);
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    arr[i].push_back(x);
    arr[x].push_back(i);
  }
  dfs(1, 1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    m1[dist[i]]++;
  }
  for (auto it = m1.begin(); it != m1.end(); it++) {
    ans += (it->second) % 2;
  }
  cout << ans << endl;
}
