#include <bits/stdc++.h>
using namespace std;
const int sz = 100000 + 2;
int freq[sz];
vector<int> g[sz];
int vis[sz];
void dfs(int u, int level) {
  vis[u] = true;
  freq[level]++;
  for (int v : g[u]) {
    if (!vis[v]) dfs(v, level + 1);
  }
}
int main() {
  memset(freq, 0, sizeof freq);
  memset(vis, 0, sizeof vis);
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    g[x].push_back(i);
    g[i].push_back(x);
  }
  dfs(1, 1);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += freq[i] % 2;
  }
  cout << ans << endl;
}
