#include <bits/stdc++.h>
using namespace std;
int dep[100010], cnt[100010], ans;
vector<int> g[100010];
void dfs(int p, int f) {
  for (int i = 0; i < g[p].size(); i++) {
    int v = g[p][i];
    dep[v] = dep[p] + 1;
    dfs(v, p);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    g[x].push_back(i);
  }
  dfs(1, 0);
  for (int i = 1; i <= n; i++) {
    cnt[dep[i]]++;
  }
  for (int i = 0; i <= n; i++) {
    if (cnt[i] & 1) ans++;
  }
  cout << ans << endl;
}
