#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
using namespace std;
inline void print_arr(int *a, int n) {
  for (int i = 0; i < n; i++) {
    printf("%d%c", a[i], i == n - 1 ? '\n' : ' ');
  }
}
inline void read_arr(int *a, int n) {
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
}
const double eps = 1e-6;
const long long mod = 1e9 + 7;
const int maxn = 1e5 + 100;
const int maxe = 1e6 + 100;
int ss[maxn];
void Solve() {
  vector<int> V[maxn];
  ss[1] = 1;
  int x;
  int n;
  V[1].push_back(1);
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    scanf("%d", &x);
    ss[i] = ss[x] + 1;
    V[ss[i]].push_back(i);
  }
  int res = 0;
  for (int i = 1; i <= n; i++) {
    res += V[i].size() & 1;
  }
  printf("%d\n", res);
}
int main() {
  int Case = 1, cases;
  while (Case--) {
    Solve();
  }
  return 0;
}
