#include <bits/stdc++.h>
using namespace std;
void file() {}
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
}
const int N = 1e6 + 20;
int cnt[N];
vector<int> v(N);
int dfs(int node) {
  if (cnt[node]) {
    return cnt[node];
  }
  int ret;
  ret = dfs(v[node]) + 1;
  return cnt[node] = ret;
}
int main() {
  file();
  fast();
  int n;
  cin >> n;
  cnt[1] = 1;
  for (int i = 2; i <= n; i++) {
    cin >> v[i];
  }
  map<int, long long> mp;
  long long ans = 0;
  for (int i = 2; i <= n; i++) {
    dfs(i);
  }
  for (int i = 1; i <= n; i++) {
    long long val = cnt[i];
    mp[val]++;
  }
  for (int i = 1; i <= n; i++) {
    if (mp[i] % 2 == 1) {
      ans++;
    }
  }
  cout << ans << endl;
}
