#include <bits/stdc++.h>
using namespace std;
class graph {
 public:
  long vn;
  vector<vector<long>> edges;
  graph() {}
  graph(long v) {
    vn = v;
    edges.assign(vn + 1, vector<long>());
  }
  void insert(long v, long u) {
    edges[v].push_back(u);
    edges[u].push_back(v);
  }
};
set<long> ds;
graph g;
void dfs(long v, long p, long d) {
  if (ds.find(d) != ds.cend()) {
    ds.erase(d);
  } else {
    ds.insert(d);
  }
  for (long u : g.edges[v]) {
    if (u != p) {
      dfs(u, v, d + 1);
    }
  }
}
int main() {
  long n;
  cin >> n;
  g = graph(n);
  for (long i = 2; i <= n; i++) {
    long p;
    cin >> p;
    g.insert(i, p);
  }
  dfs(1, 1, 0);
  long res = ds.size();
  cout << res << endl;
  return 0;
}
