#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<int> edge[N];
int cnt[N], n, ans = 0;
void DFS(int u, int dep) {
  cnt[dep]++;
  for (int i = 0; i < edge[u].size(); i++) DFS(edge[u][i], dep + 1);
}
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int t;
    cin >> t;
    edge[t].push_back(i);
  }
  DFS(1, 0);
  for (int i = 0; i < n; i++) ans += cnt[i] % 2;
  cout << ans << endl;
  return 0;
}
