#include <bits/stdc++.h>
using namespace std;
long long int vis[100010], d[100010];
vector<long long int> g[100010];
int main() {
  long long int n, level = -1, ans = 0;
  cin >> n;
  for (long long int i = 2; i <= n; i++) {
    long long int x;
    cin >> x;
    g[x].push_back(i);
    g[i].push_back(x);
  }
  queue<pair<long long int, long long int> > q;
  q.push(make_pair(1, 0));
  while (!q.empty()) {
    pair<long long int, long long int> x = q.front();
    q.pop();
    vis[x.first] = 1;
    level = max(level, x.second);
    if (x.first == 1)
      d[x.second] += g[x.first].size();
    else
      d[x.second] += g[x.first].size() - 1;
    for (long long int i = 0; i < g[x.first].size(); i++) {
      long long int v = g[x.first][i];
      if (!vis[v]) q.push(make_pair(v, x.second + 1));
    }
  }
  if (level == 0) {
    if (d[0] % 2) ans++;
  } else {
    for (long long int i = 0; i <= level; i++) {
      if (d[i] % 2)
        ans++;
      else {
        if (i + 1 <= level) {
          if (d[i + 1] % 2) {
            ans++;
            i++;
          }
        }
      }
    }
  }
  cout << ans + 1 << endl;
  return 0;
}
