#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 5;
vector<vector<long long int>> v;
long long int T = 0;
vector<long long int> dep;
bool visited[MAX];
vector<long long int> par;
vector<long long int> tin, tout, a;
long long int f = 0, k = 1;
void dfs(long long int s, long long int p = -1, long long int d = 0) {
  dep[s] = d;
  for (auto it : v[s]) {
    if (it == p) continue;
    dfs(it, s, d + 1);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int n;
  cin >> n;
  v = vector<vector<long long int>>(n + 1);
  par = dep = vector<long long int>(n + 1);
  long long int x;
  for (long long int i = 2; i <= n; i++) {
    cin >> x;
    v[x].push_back(i);
    v[i].push_back(x);
  }
  dfs(1);
  long long int hash[n + 1];
  memset(hash, 0, sizeof(hash));
  for (long long int i = 1; i <= n; i++) {
    hash[dep[i]]++;
  }
  long long int cnt = 0;
  for (long long int i = 0; i <= n; i++) {
    if (hash[i] & 1) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
