#include <bits/stdc++.h>
using namespace std;
vector<int long long> adj[200005];
bool vis[100005];
int long long level = 0;
map<int long long, int long long> mp;
int long long res[200005];
int long long sz[200005];
int long long dep[200005];
void dfs(int long long v) {
  sz[v] = 1;
  for (auto u : adj[v]) {
    if (sz[u]) continue;
    dep[u] = dep[v] + 1;
    dfs(u);
    sz[v] += sz[u];
  }
}
int32_t main() {
  int long long n;
  cin >> n;
  int long long a, b, ctr = 0;
  for (int long long i = 2; i < n + 1; i++) {
    cin >> a;
    adj[a].push_back(i);
  }
  dfs(1);
  map<int long long, int long long> mp;
  for (int long long i = 1; i <= n; i++) {
    mp[dep[i]]++;
  }
  int long long ans = 0;
  for (auto x : mp) {
    if (x.second % 2 == 1) ans++;
  }
  cout << ans << endl;
}
