#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int *arr = new int[n + 1];
  int maxi = 0;
  for (int i = 2; i <= n; ++i) {
    cin >> arr[i];
  }
  int *depth = new int[n + 1];
  depth[1] = 0;
  for (int i = 2; i <= n; ++i) {
    depth[i] = depth[arr[i]] + 1;
  }
  for (int i = 1; i <= n; ++i) {
    maxi = max(maxi, depth[i]);
  }
  int *count = new int[maxi + 1];
  for (int i = 1; i <= maxi; ++i) {
    count[i] = 0;
  }
  for (int i = 1; i <= n; ++i) {
    count[depth[i]] += 1;
  }
  int res = 1;
  for (int i = 1; i <= maxi; ++i) {
    if (count[i] % 2) res++;
  }
  cout << res << endl;
}
