#include <bits/stdc++.h>
using namespace std;
long long int logy(long long int x, long long int y) {
  return ceil((long double)(log(x) / log(y)));
}
long long int powe(long long int a, long long int b) {
  long long int re = 1;
  while (b) {
    if (b & 1) re = (re * a) % 1000000007;
    a = (a * a) % 1000000007;
    b = b >> 1;
  }
  return re;
}
bool flag = 0, flag1 = 0, flag2 = 0;
vector<vector<long long> > v(100005);
long long int lev[100005], n, leval = 1;
bool vis[100005] = {0};
void dfs(long long int u) {
  vis[u] = 1;
  lev[u] = leval;
  for (auto i : v[u]) {
    if (!vis[i]) {
      leval++;
      dfs(i);
    }
  }
  leval--;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int tt = 1;
  while (tt--) {
    cin >> n;
    for (long long int i = 2; i < n + 1; i++) {
      long long int x;
      cin >> x;
      v[i].push_back(x);
      v[x].push_back(i);
    }
    dfs(1);
    map<long long int, long long int> m;
    for (long long int i = 1; i < n + 1; i++) m[lev[i]]++;
    long long int ans = 0;
    for (auto i : m) {
      if (i.second & 1) ans++;
    }
    cout << ans;
  }
  return 0;
}
