#include <bits/stdc++.h>
using namespace std;
const int LEN = 1e5 + 10;
vector<vector<int>> g(LEN);
vector<int> s(LEN, -1);
void dfs(int v, int level) {
  s[v] = level;
  for (auto to : g[v]) {
    dfs(to, level + 1);
  }
}
void solve() {
  int n, pi;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> pi;
    g[pi - 1].push_back(i);
  }
  dfs(0, 0);
  vector<int> cnt(n, 0);
  for (int i = 0; i < n; i++) {
    cnt[s[i]]++;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) ans += cnt[i] % 2;
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}
