#include <bits/stdc++.h>
using namespace std;
static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
const int lim = 1e5 + 10;
vector<int> A[lim];
int dist[lim];
void DFS(int ver, int par, int level) {
  dist[level]++;
  for (int a : A[ver]) {
    if (a == par) continue;
    DFS(a, ver, level + 1);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 2; i <= n; ++i) {
    int a;
    scanf("%d", &a);
    A[a].push_back(i);
  }
  memset(dist, 0, sizeof(dist));
  DFS(1, -1, 1);
  int ans = 0;
  for (int i = 1; i < n + 1; ++i) {
    if (dist[i] % 2 == 1) ans++;
  }
  cout << ans << endl;
  return 0;
}
