#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
std::vector<int> G[maxn];
int num[maxn];
void dfs(int rt, int path) {
  num[rt] = path;
  for (int i = 0; i < G[rt].size(); ++i) {
    dfs(G[rt][i], path + 1);
  }
}
int main(int argc, char const *argv[]) {
  int n;
  scanf("%d", &n);
  memset(num, 0, sizeof num);
  for (int i = 2; i <= n; i++) {
    int v;
    scanf("%d", &v);
    G[v].push_back(i);
  }
  dfs(1, 0);
  sort(num + 1, num + n + 1);
  int cnt = 1, ans = 0;
  for (int i = 2; i <= n; i++) {
    if (num[i] == num[i - 1])
      cnt++;
    else {
      ans += (cnt % 2);
      cnt = 1;
    }
  }
  ans += (cnt % 2);
  printf("%d\n", ans);
  return 0;
}
