#include <bits/stdc++.h>
using namespace std;
int tot[100005];
long long level[100005];
long long big;
vector<int> v[100005];
bool vis[100005];
void bfs(int n) {
  vis[n] = true;
  level[n] = 0;
  queue<int> q;
  q.push(n);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (auto curr : v[u]) {
      if (vis[curr] == true) continue;
      vis[curr] = true;
      level[curr] = level[u] + 1;
      q.push(curr);
      tot[level[curr]]++;
      big = max(level[curr], big);
    }
  }
}
int main() {
  int n;
  big = -100000000000014;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    long long int x;
    cin >> x;
    v[x].push_back(i);
    v[i].push_back(x);
  }
  bfs(1);
  long long sum = 0;
  for (int i = 1; i <= big; i++) {
    if (tot[i] % 2 == 1) sum++;
  }
  cout << sum + 1 << endl;
  return 0;
}
