#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s = 0;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n - 1);
  vector<int> c(n);
  for (int i = 1; i < n; i++) {
    cin >> a[i];
    c[i] = 1 + c[a[i] - 1];
    b[c[i] - 1]++;
  }
  for (int j = 0; j < n - 1; j++) s += b[j] % 2;
  cout << s + 1 << endl;
  return 0;
}
