#include <bits/stdc++.h>
using namespace std;
vector<int> g[110000];
int n, x, d[110000], c[110000], a[110000];
void dfs(int x, int fa) {
  d[x] = d[fa] + 1;
  a[d[x]] = (a[d[x]] + 1) % 2;
  for (int i = 0; i < g[x].size(); i++) dfs(g[x][i], x);
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> x;
    g[x].push_back(i);
  }
  dfs(1, 0);
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += a[i];
  cout << ans << endl;
  return 0;
}
