#include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e5 + 2, inf = 1e9 + 7;
int dp[Nmax], depth[Nmax];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, ans = 0, hV;
  cin >> n;
  for (int i = 1; i < n; ++i) {
    cin >> hV;
    dp[i] = dp[hV - 1] + 1;
    depth[dp[i]] ^= 1;
  }
  for (int i = 0; i < n; ++i) ans += depth[i + 1];
  cout << ans + 1 << '\n';
}
