#include <bits/stdc++.h>
using namespace std;
void dubug_arr(vector<int> &a) {
  int len = a.size();
  for (int i = 0; i < len; ++i) {
    cout << a[i] << " ";
  }
  cout << endl;
}
const int mod = 1e9 + 7;
const int mod1 = 998244353;
int n;
vector<bool> visited;
vector<int> level;
vector<vector<int> > adj;
void bfs(int second, int l) {
  queue<int> q;
  visited[second] = true;
  level[second] = l;
  q.push(second);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (auto u : adj[v]) {
      if (!visited[u]) {
        level[u] = level[v] + 1;
        visited[u] = true;
        q.push(u);
      }
    }
  }
}
void solve() {
  cin >> n;
  adj.resize(n + 1);
  visited.resize(n + 1, false);
  level.resize(n + 1);
  for (int i = 2; i < n + 1; ++i) {
    int x;
    cin >> x;
    adj[x].push_back(i);
    adj[i].push_back(x);
  }
  bfs(1, 0);
  vector<int> count(n + 1);
  for (int i = 1; i < n + 1; ++i) {
    count[level[i]]++;
  }
  int ans = 0;
  for (int i = 0; i < count.size(); ++i) {
    ans += count[i] % 2 ? 1 : 0;
  }
  cout << ans << endl;
  return;
}
signed main() {
  { solve(); }
  return 0;
}
