#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
T pow(T a, T b, long long m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
const long long N = 1e5 + 5;
long long n;
long long level[N];
vector<long long> g[N];
void dfs(long long k, long long par, long long lvl) {
  level[lvl]++;
  for (auto it : g[k]) {
    if (it == par) continue;
    dfs(it, k, lvl + 1);
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 2; i <= n; i++) {
    long long p;
    cin >> p;
    g[p].push_back(i);
    g[i].push_back(p);
  }
  dfs(1, 1, 1);
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    ans += level[i] % 2;
  }
  cout << ans;
  return 0;
}
