#include <bits/stdc++.h>
using namespace std;
int n, dalam[100005], cnt[100005];
vector<vector<int>> arr(100005);
bool vis[100005];
void dfs(int x) {
  vis[x] = 1;
  for (auto i : arr[x]) {
    if (!vis[i]) {
      dalam[i] = dalam[x] + 1;
      dfs(i);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 2; i <= n; ++i) {
    long long x;
    cin >> x;
    arr[x].push_back(i);
    arr[i].push_back(x);
  }
  for (int i = 1; i <= n; ++i) {
    if (vis[i]) continue;
    dalam[i] = 0;
    vis[i] = 1;
    for (auto x : arr[i]) {
      if (!vis[x]) {
        dalam[x] = 1;
        dfs(x);
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    cnt[dalam[i]]++;
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += cnt[i] % 2;
  }
  cout << ans << '\n';
}
