#include <bits/stdc++.h>
using namespace std;
int read() {
  int tot = 0, fh = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') fh = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    tot = tot * 10 + c - '0';
    c = getchar();
  }
  return tot * fh;
}
const int maxn = 1e5 + 100;
struct compass {
  int nxt, dat;
} p[maxn * 2];
int depth[maxn], tot, ha[maxn], n, ans, x, head[maxn];
void connect(int x, int y) {
  tot++;
  p[tot].nxt = head[x];
  p[tot].dat = y;
  head[x] = tot;
}
void dfs(int x, int fa) {
  depth[x] = depth[fa] + 1;
  ha[depth[x]]++;
  for (int i = head[x]; i; i = p[i].nxt)
    if (p[i].dat != fa) dfs(p[i].dat, x);
}
int main() {
  n = read();
  for (int i = 2; i <= n; i++) {
    x = read();
    connect(i, x);
    connect(x, i);
  }
  dfs(1, 0);
  for (int i = 1; i <= 100000; i++)
    if (ha[i] % 2 == 1) ans++;
  cout << ans << "\n";
  return 0;
}
