#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
int dep[maxn], n, cnt[maxn], ans;
vector<int> g[maxn];
void dfs(int p, int fa) {
  for (int i = 0; i < g[p].size(); i++) {
    int v = g[p][i];
    dep[v] = dep[p] + 1;
    dfs(v, p);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int x;
    scanf("%d", &x);
    g[x].push_back(i);
  }
  dfs(1, 0);
  for (int i = 1; i <= n; i++) cnt[dep[i]]++;
  for (int i = 0; i <= n; i++)
    if (cnt[i] & 1) ans++;
  printf("%d\n", ans);
}
