#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0l);
const long long MOD = 1e9 + 7;
bool debug = 0;
const int N = 1e5 + 10;
int ans = 0;
vector<int> g[N];
int dist[N];
int f[N];
void dfs(int no, int from, int d) {
  if (debug)
    cout << "no"
         << " = " << (no) << endl;
  if (debug)
    cout << "d"
         << " = " << (d) << endl;
  if (debug) cout << endl;
  dist[no] = d;
  for (auto it : g[no]) {
    if (it == from) continue;
    dfs(it, no, d + 1);
  }
  return;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int x;
    scanf("%d", &x);
    x--;
    g[i].push_back(x);
    g[x].push_back(i);
  }
  dfs(0, -1, 0);
  for (int i = 0; i < n; i++)
    if (debug)
      cout << "dist[i]"
           << " = " << (dist[i]) << endl;
  for (int i = 0; i < n; i++) {
    f[dist[i]]++;
  }
  for (int i = 0; i < n; i++) {
    ans += f[i] % 2;
  }
  cout << ans << endl;
  return 0;
}
