#include <bits/stdc++.h>
using namespace std;
inline unsigned long long int in() {
  unsigned long long int p = 0;
  register char ch = 0;
  while (ch < '0' or ch > '9') {
    ch = getchar();
  }
  while (ch >= '0' and ch <= '9') {
    p = (p << 1) + (p << 3) + ch - '0';
    ch = getchar();
  }
  return p;
}
inline void dukya(unsigned long long int n) {
  unsigned long long int N = n, rev, count_ = 0;
  rev = N;
  if (N == 0) {
    putchar('0');
    putchar('\n');
    return;
  }
  while ((rev % 10) == 0) {
    count_++;
    rev /= 10;
  }
  rev = 0;
  while (N != 0) {
    rev = (rev << 3) + (rev << 1) + N % 10;
    N /= 10;
  }
  while (rev != 0) {
    putchar(rev % 10 + '0');
    rev /= 10;
  }
  while (count_--) putchar('0');
  putchar('\n');
}
long long int n;
vector<long long int> adjlist[1000005];
long long int cnt[1000005];
long long int dfs(long long int u = 0, long long int df = 1) {
  long long int ans = df;
  for (long long int i = 0; i < adjlist[u].size(); ++i) {
    ans = max(ans, dfs(adjlist[u][i], df + 1));
  }
  cnt[df - 1] += 1;
  return ans;
}
int main() {
  memset(cnt, 0, sizeof cnt);
  n = in();
  long long int u;
  for (long long int i = 0; i < n - 1; ++i) {
    u = in() - 1;
    adjlist[u].push_back(i + 1);
  }
  long long int df = dfs();
  long long int ans = 0;
  for (long long int i = 0; i < df; ++i) {
    ans += cnt[i] % 2;
  }
  cout << ans << "\n";
  return 0;
}
