#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
const double eps = 1e-6;
const int INF = 1 << 30;
const int mod = 1e8;
int ans = 1, n, m, b[MAXN];
vector<int> a[MAXN];
void dfs(int now, int deep) {
  b[deep] += a[now].size();
  vector<int>::iterator it;
  for (it = a[now].begin(); it != a[now].end(); it++) {
    dfs(*it, deep + 1);
  }
}
int main() {
  cin >> n;
  memset(b, 0, sizeof(b));
  for (int i = 2; i <= n; i++) cin >> m, a[m].push_back(i);
  dfs(1, 1);
  int k = 1;
  while (b[k] != 0) {
    if (b[k] % 2 == 1) ans++;
    k++;
  }
  cout << ans << endl;
}
