#include <bits/stdc++.h>
using namespace std;
const int maxsize = 1e5 + 10;
struct node {
  int id;
  int cnt;
};
int n;
vector<int> p[maxsize];
queue<node> q;
int num[maxsize];
void solve() {
  memset(num, 0, sizeof(num));
  q.push({1, 1});
  num[1]++;
  node now;
  int ans = 1;
  while (!q.empty()) {
    now = q.front();
    num[now.cnt]++;
    q.pop();
    for (int i = 0; i < p[now.id].size(); i++) {
      q.push({p[now.id][i], now.cnt + 1});
    }
  }
  for (int i = 1; i <= n; i++) {
    ans += (num[i] & 1);
  }
  printf("%d\n", ans);
}
int main(void) {
  int x;
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &x);
    p[x].push_back(i);
  }
  solve();
  return 0;
}
