#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 5;
int ans = 1;
int n, y[maxn], depth[maxn], cnt[maxn];
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) cin >> y[i];
  memset(cnt, 0, sizeof(cnt));
  depth[1] = 0;
  for (int i = 2; i <= n; i++) {
    depth[i] = depth[y[i]] + 1;
    cnt[depth[i]]++;
  }
  for (int i = 1; i <= n; i++)
    if (cnt[i] & 1) ans++;
  cout << ans << endl;
}
