#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
struct Edg {
  int nxt, poi;
} e[N << 1];
int deep[N], first[N], ans, sum[N], l = 0;
void addedge(int u, int v) {
  l++;
  e[l].nxt = first[u];
  e[l].poi = v;
  first[u] = l;
}
void dfs(int u, int f) {
  deep[u] = deep[f] + 1;
  sum[deep[u]]++;
  for (int p = first[u]; p; p = e[p].nxt) {
    int v = e[p].poi;
    if (v == f) continue;
    dfs(v, u);
  }
}
int main() {
  int n = read();
  for (int i = 2; i <= n; i++) {
    int fa = read();
    addedge(fa, i);
  }
  dfs(1, 1);
  for (int i = 1; i <= n; i++) {
    if (sum[deep[i]] == 0) continue;
    sum[deep[i]] %= 2;
    ans += sum[deep[i]];
    if (sum[deep[i]] == 1) sum[deep[i]]--;
  }
  printf("%d\n", ans);
  return 0;
}
