#include <bits/stdc++.h>
using namespace std;
const int N = int(1e5 + 5);
vector<int> g[N];
int cnt[N];
void dfs(int v, int depth = 0) {
  cnt[depth]++;
  for (int to : g[v]) {
    dfs(to, depth + 1);
  }
}
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    g[p].push_back(i);
  }
  dfs(1);
  int res = 0;
  for (int i = 0; i <= n; i++) {
    res += cnt[i] % 2;
  }
  cout << res << endl;
  return 0;
}
