#include <bits/stdc++.h>
using namespace std;
template <class T, class T2>
inline void chkmax(T &x, const T2 &y) {
  if (x < y) x = y;
}
template <class T, class T2>
inline void chkmin(T &x, const T2 &y) {
  if (x > y) x = y;
}
const int MAXN = (1 << 20);
int n, d[MAXN];
void read() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    d[i] = d[x] + 1;
  }
}
void solve() {
  set<int> s;
  for (int i = 1; i <= n; i++)
    if (s.find(d[i]) != s.end())
      s.erase(d[i]);
    else
      s.insert(d[i]);
  cout << s.size() << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}
