#include <bits/stdc++.h>
using namespace std;
int a[100005];
int n;
vector<int> child[100005];
int ceng[100005];
void dfs(int v, int ii) {
  ceng[ii]++;
  for (int i = 0; i < child[v].size(); i++) {
    dfs(child[v][i], ii + 1);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int tmp;
    scanf("%d", &tmp);
    child[tmp].push_back(i);
  }
  int ans = 0;
  dfs(1, 1);
  for (int i = 1; i <= n; i++) {
    if (ceng[i] % 2 == 0) {
      ceng[i] = 0;
    }
    if (ceng[i]) ceng[i] = 1;
    ans += ceng[i];
  }
  cout << ans << endl;
}
