#include <bits/stdc++.h>
template <class T>
inline T gcd(T a, T b) {
  a = abs(a);
  b = abs(b);
  if (!b) return a;
  return __gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  a = abs(a);
  b = abs(b);
  return (a / __gcd(a, b)) * b;
}
template <class T>
inline T ncr(T n, T r) {
  return n * (n - 1) / r;
}
using namespace std;
vector<int> gr[100001];
int visited[100001];
int level[100001];
int lvl[100001], ans;
void bfs(int s) {
  queue<int> q;
  q.push(s);
  visited[s] = 1;
  level[s] = 0;
  while (!q.empty()) {
    int u = q.front();
    for (int i = 0; i < gr[u].size(); i++) {
      int v = gr[u][i];
      if (visited[v] == 0) {
        q.push(v);
        visited[v] = 1;
        level[v] = level[u] + 1;
        lvl[level[v]]++;
      }
    }
    q.pop();
  }
}
void solve() {
  for (int i = 1; lvl[i] > 0; i++) {
    if (lvl[i] % 2 == 1) ans++;
  }
  cout << ans + 1 << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  int a;
  for (int i = 2; i <= n; i++) {
    cin >> a;
    gr[a].push_back(i);
  }
  bfs(1);
  solve();
  return 0;
}
