#include <bits/stdc++.h>
using namespace std;
int otv, i, n, l, V;
int p[100001], x[100001], ch[100001];
bool check[100001];
int dfs(int n) {
  if (n == 1) {
    check[n] = true;
    V = 0;
  } else {
    if (!check[n]) {
      V = dfs(p[n]) + 1;
      check[n] = true;
    } else
      V = x[n];
  }
  return V;
}
void Search() {
  for (i = 1; i <= n; i++) x[i] = -1;
  for (i = 1; i <= n; i++) {
    x[i] = dfs(i);
    ch[x[i]]++;
  }
  for (i = 1; i <= n; i++)
    if (ch[i] % 2 != 0) otv++;
}
int main() {
  cin >> n;
  for (i = 2; i <= n; i++) {
    cin >> p[i];
  }
  Search();
  cout << otv + 1;
}
