#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> adj[N];
int a[N];
void dfs(int s, int c) {
  a[c]++;
  for (auto it : adj[s]) dfs(it, c + 1);
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    adj[x].push_back(i);
  }
  dfs(1, 0);
  int ans = 0;
  for (int i = 0; i <= n; i++) ans += (a[i] % 2);
  cout << ans << endl;
}
