#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T abs(T t) {
  return t < 0 ? -t : t;
}
const long long modn = 1000000007;
inline long long mod(long long x) { return x % modn; }
const int MAXN = 212345;
int n, m, k;
vector<int> adj[MAXN];
int p[MAXN];
queue<int> q[2];
int go(int u) {
  int h = 0;
  q[h].push(u);
  int res = 0;
  while (!q[h].empty()) {
    res += (q[h].size()) % 2;
    while (!q[h].empty()) {
      u = q[h].front();
      q[h].pop();
      for (int nxt : adj[u]) q[h ^ 1].push(nxt);
    }
    h = (h ^ 1);
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (int a = 2; a <= n; a++) {
    scanf("%d", p + a);
    adj[p[a]].push_back(a);
  }
  printf("%d\n", go(1));
}
