#include <bits/stdc++.h>
const long double eps = 1e-8;
using namespace std;
vector<long long int> adj[100005];
vector<long long int> vis(100005);
vector<long long int> dis(100005);
void dfs(long long int x, long long int d) {
  vis[x] = 1;
  dis[x] = d;
  for (auto u : adj[x])
    if (!vis[u]) dfs(u, d + 1);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a;
    for (long long int i = 2; i < n + 1; i++) {
      cin >> a;
      adj[a].push_back(i);
      adj[i].push_back(a);
    }
    dfs(1, 0);
    vector<long long int> fre(n + 3);
    for (long long int i = 1; i < n + 1; i++) {
      fre[dis[i]]++;
    }
    long long int ans = 0;
    for (long long int i = 0; i < n + 3; i++) ans += (fre[i] % 2);
    cout << ans << "\n";
  }
}
