#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 2e9;
const long long INFLL = 1e18;
const int MAX_N = 100000;
vector<int> gp[MAX_N + 1];
int N;
int p[MAX_N + 1];
int cnt[MAX_N + 1];
int lv[MAX_N + 1];
void dfs(int x) {
  cnt[lv[x]]++;
  for (int i : gp[x]) {
    lv[i] = lv[x] + 1;
    dfs(i);
  }
}
int main() {
  scanf("%d", &N);
  for (int i = 2; i <= N; i++) {
    scanf("%d", &p[i]);
    gp[p[i]].push_back(i);
  }
  lv[1] = 1;
  dfs(1);
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    ans += (cnt[i] % 2);
  }
  cout << ans;
  return 0;
}
