#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9 + 3;
const int N = 1e5 + 3;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
int lvl[N];
vector<int> gr[N];
void dfs(int cur, int dep) {
  lvl[dep]++;
  for (int v : gr[cur]) dfs(v, dep + 1);
}
void solve() {
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    gr[p].push_back(i);
  }
  dfs(1, 1);
  int ans = 0;
  for (int l = 1; l <= n; l++) ans += lvl[l] & 1;
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
}
