#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int logN = 17;
const int N = 1e6 + 7;
const int mod = 1e9 + 7;
int n, m, x, D[N];
vector<int> v[N];
void dfs(int node, int d) {
  D[d]++;
  for (auto x : v[node]) dfs(x, d + 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &x);
    v[x].push_back(i);
  }
  int ans = 0;
  dfs(1, 1);
  for (int i = 1; i <= n; i++) {
    ans += D[i] % 2;
  }
  cout << ans << endl;
  return 0;
}
