#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long INF = 1LL << 62;
const long long MINF = -(1LL << 62);
template <typename T>
T getint() {
  T val = 0;
  char c;
  bool neg = false;
  while ((c = getchar()) && !(c >= '0' && c <= '9')) {
    neg |= c == '-';
  }
  do {
    val = (val * 10) + c - '0';
  } while ((c = getchar()) && (c >= '0' && c <= '9'));
  return val * (neg ? -1 : 1);
}
vector<int> adj[100001];
int lvl[100001], st[100001];
void dfs(int x, int akt = 0) {
  st[x] = 1;
  lvl[akt]++;
  for (auto i : adj[x]) {
    if (!st[i]) dfs(i, akt + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    int x;
    cin >> x;
    adj[x].push_back(i);
    adj[i].push_back(x);
  }
  dfs(1);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += lvl[i] & 1;
  }
  cout << ans << "\n";
  return 0;
}
