#include <bits/stdc++.h>
using namespace std;
struct l {
  int index;
  int depth;
  int color;
};
int a[100001];
struct BFSearch {
  vector<pair<l, vector<int> > > adj;
  queue<l> k;
  void clear1() {
    for (int i = 0; i < adj.size(); i++) {
      adj[i].first.color = 0;
      adj[i].first.depth = -1;
    }
  }
  void bfs(int i) {
    if (i > adj.size() - 1) return;
    l o;
    int p;
    adj[i].first.color = 0;
    adj[i].first.depth = 0;
    k.push(adj[i].first);
    while (k.size() != 0) {
      o = k.front();
      k.pop();
      for (int i = 0; i < adj[o.index].second.size(); i++) {
        p = adj[o.index].second[i];
        if (adj[p].first.color == 0) {
          adj[p].first.color = 1;
          adj[p].first.depth = o.depth + 1;
          k.push(adj[p].first);
        }
      }
      adj[o.index].first.color = 2;
    }
  }
};
int main() {
  pair<l, vector<int> > op;
  BFSearch k;
  int n, temp;
  l p;
  p.depth = -1;
  p.color = 0;
  cin >> n;
  vector<int> x;
  for (int i = 0; i < n; i++) {
    op.second = x;
    p.index = i;
    op.first = p;
    k.adj.push_back(op);
  }
  for (int i = 1; i < n; i++) {
    cin >> temp;
    k.adj[i].second.push_back(temp - 1);
    k.adj[temp - 1].second.push_back(i);
  }
  k.bfs(0);
  for (int i = 0; i < k.adj.size(); i++) {
    a[k.adj[i].first.depth]++;
  }
  long sum = 0;
  for (int i = 0; i < k.adj.size(); i++) {
    if (a[i] % 2 == 1) sum += 1;
  }
  cout << sum;
}
