#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
int n;
vector<int> g[maxn];
int d[maxn];
void dfs(int x, int depth) {
  d[depth]++;
  for (int w : g[x]) {
    dfs(w, depth + 1);
  }
}
int main() {
  scanf("%d", &n);
  int a, b;
  for (int i = 0; i < (n - 1); ++i) {
    scanf("%d", &a);
    g[a].push_back(i + 2);
  }
  dfs(1, 1);
  int sum = 0;
  for (int i = 1; i <= (n); ++i) {
    sum += d[i] % 2;
  }
  printf("%d\n", sum);
}
