#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LNF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1000000007;
const double EPS = 1e-8;
const long double EUL = 2.71828182845904523536;
const long double PII = 3.14159265358979323846;
vector<vector<int>> graph;
vector<int> col;
void dfs(int v = 1, int p = -1, int color = 0) {
  col[color]++;
  for (auto x : graph[v]) {
    if (x == p) continue;
    dfs(x, v, color + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  while (cin >> n) {
    graph = vector<vector<int>>(n + 1);
    col.assign(n + 1, 0);
    for (int i = 2; i <= n; i++) {
      int x;
      cin >> x;
      graph[i].push_back(x);
      graph[x].push_back(i);
    }
    dfs();
    int ans = 0;
    for (auto x : col) ans += (x % 2);
    cout << ans << endl;
  }
  cerr << "Time : " << 1000 * (long double)clock() / (long double)CLOCKS_PER_SEC
       << "ms\n";
  return 0;
}
