#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
int n;
int dis[maxn];
vector<int> e[maxn];
int ans[maxn];
void dfs(int x) {
  int i, j, len = e[x].size();
  for (i = 0; i < len; ++i) {
    j = e[x][i];
    dis[j] = dis[x] + 1;
    dfs(j);
  }
}
int main() {
  int i, j, k, T;
  cin >> n;
  for (i = 2; i <= n; ++i) {
    cin >> j;
    e[j].push_back(i);
  }
  dis[1] = 0;
  dfs(1);
  for (i = 1; i <= n; ++i) {
    ans[dis[i]] ^= 1;
  }
  for (i = 1; i <= n; ++i) ans[0] += ans[i];
  cout << ans[0] << endl;
  return 0;
}
