#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
void OFAST() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
}
const int N = 100100;
int d[N], n, u;
vector<int> dsk[N];
void dfs(int u, int h) {
  d[h] ^= 1;
  for (int v : dsk[u]) dfs(v, h + 1);
}
int main() {
  OFAST();
  cin >> n;
  for (int i = (2), _b = (n); i <= _b; ++i) cin >> u, dsk[u].push_back(i);
  dfs(1, 1);
  int ans = 0;
  for (int i = (0), _b = (N); i < _b; ++i) ans += d[i];
  cout << ans;
}
