#include <bits/stdc++.h>
using namespace std;
long long child[100001];
long long lev[100001];
long long sum[100001];
long long ma = 0;
void dfs(long long x, vector<long long> v[], bool vis[]) {
  if (vis[x] == false) vis[x] = true;
  for (long long i = 0; i < v[x].size(); i++) {
    if (vis[v[x][i]] == false) {
      vis[v[x][i]] = true;
      lev[v[x][i]] = lev[x] + 1;
      sum[lev[v[x][i]]]++;
      dfs(v[x][i], v, vis);
      ma = max(ma, lev[v[x][i]]);
    }
  }
}
signed main() {
  memset(sum, 0, sizeof(sum));
  long long n;
  cin >> n;
  vector<long long> v[n + 1];
  for (long long i = 2; i <= n; i++) {
    long long x;
    cin >> x;
    v[x].push_back(i);
    v[i].push_back(x);
  }
  bool vis[n + 1];
  memset(vis, false, sizeof(vis));
  lev[1] = 1;
  dfs(1, v, vis);
  long long cnt = 0;
  for (long long i = 2; i <= ma; i++) {
    if (sum[i] % 2 != 0) cnt++;
  }
  cout << cnt + 1 << endl;
}
