#include <bits/stdc++.h>
using namespace std;
vector<int> G[100000];
int used[100000];
int dist[100000];
void dfs(int v) {
  used[v] = true;
  for (int i = 0; i < (int)G[v].size(); ++i) {
    if (!used[G[v][i]]) {
      dist[G[v][i]] = dist[v] + 1;
      dfs(G[v][i]);
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < (n); ++i) {
    int a;
    cin >> a;
    G[a - 1].push_back(i);
    G[i].push_back(a - 1);
  }
  dfs(0);
  sort(dist, dist + n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    int y = 1;
    while ((i + 1) < n && dist[i] == dist[i + 1]) {
      i++;
      y++;
    }
    if (y % 2 == 1) ans++;
  }
  cout << ans;
  return 0;
}
