#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <class T>
void print(vector<T> s) {
  for (int i = 0; i < s.size(); i++) cout << s[i] << " ";
  cout << endl;
}
vector<vector<int> > s;
vector<int> color;
vector<int> h;
void dfs(int v) {
  color[v] = 1;
  for (int u : s[v]) {
    if (color[u] == 0) {
      h[u] = h[v] + 1;
      dfs(u);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  s.resize(n);
  for (int i = 1; i < n; i++) {
    int x;
    cin >> x;
    s[x - 1].push_back(i);
    s[i].push_back(x - 1);
  }
  color.resize(n);
  h.resize(n);
  dfs(0);
  vector<int> cnt(n, 0);
  for (int i = 0; i < n; i++) cnt[h[i]] ^= 1;
  int answer = 0;
  for (int i = 0; i < n; i++) answer += cnt[i];
  cout << answer << endl;
  return 0;
}
