#include <bits/stdc++.h>
using namespace std;
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
vector<int> vec[100010];
int lev[100010];
int vis[100010], level[100010], mx;
void bfs() {
  memset(level, 0, sizeof(level));
  memset(vis, 0, sizeof(vis));
  queue<int> q;
  q.push(1);
  vis[1] = 1;
  level[1] = 0;
  lev[0]++;
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    for (int i = 0; i < vec[now].size(); i++) {
      int v = vec[now][i];
      if (!vis[v]) {
        vis[v] = 1;
        level[v] = level[now] + 1;
        lev[level[v]]++;
        mx = max(mx, level[v]);
        q.push(v);
      }
    }
  }
}
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    memset(vec, 0, sizeof(vec));
    memset(lev, 0, sizeof(lev));
    mx = 0;
    int i, j, k, ar1[100010];
    for (i = 1; i < n; i++) {
      scanf("%d", &ar1[i]);
      vec[ar1[i]].push_back(i + 1);
    }
    bfs();
    int ans = 0;
    for (i = 0; i <= mx; i++) {
      if (lev[i] % 2 == 1) ans++;
    }
    deb(ans);
  }
}
