#include <bits/stdc++.h>
using namespace std;
const int N = 1e5;
vector<int> g[N];
int cnt[N];
void dfs(int v, int p, int depth) {
  ++cnt[depth];
  for (int u : g[v]) {
    if (u == p) continue;
    dfs(u, v, depth + 1);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) cnt[i] = 0;
  for (int i = 1, p; i < n; ++i) {
    scanf("%d", &p);
    --p;
    g[i].push_back(p);
    g[p].push_back(i);
  }
  dfs(0, -1, 0);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += (cnt[i] & 1);
  }
  printf("%d", ans);
}
