#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
int n;
vector<int> G[N];
int h[N], cnt[N];
int res = 0;
void dfs(int u, int p) {
  cnt[h[u]]++;
  for (int v : G[u])
    if (v != p) {
      h[v] = h[u] + 1;
      dfs(v, u);
    }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n - 1; ++i) {
    int x;
    cin >> x;
    G[x].push_back(i + 1);
  }
  h[1] = 1;
  dfs(1, 0);
  for (int i = 1; i <= n; ++i) res += (cnt[i] % 2);
  cout << res;
}
