#include <bits/stdc++.h>
using namespace std;
long long z = 1000000007;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a) % z;
      b--;
    } else {
      a = (a * a) % z;
      b = b >> 1;
    }
  }
  return res;
}
vector<long long> v[100001];
void bfs(long long root, long long dis[]) {
  long long vis[100001] = {0};
  queue<long long> q;
  q.push(root);
  long long a;
  while (!q.empty()) {
    a = q.front();
    q.pop();
    vis[a] = 1;
    for (long long i = 0; i < v[a].size(); i++) {
      if (!vis[v[a][i]]) {
        q.push(v[a][i]);
        dis[v[a][i]] = dis[a] + 1;
      }
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    long long n;
    cin >> n;
    long long x;
    map<long long, long long> m;
    for (long long i = 1; i < n; i++) {
      cin >> x;
      x--;
      v[x].push_back(i);
      v[i].push_back(x);
    }
    long long dis[n + 1];
    memset(dis, 0, sizeof(dis));
    bfs(0, dis);
    sort(dis, dis + n);
    long long ans = 1;
    long long p = 1;
    dis[n] = -1;
    for (long long i = 1; i < n; i++) {
      if (dis[i] == dis[i + 1])
        p++;
      else {
        if (p & 1) ans++;
        p = 1;
      }
    }
    cout << ans << "\n";
  }
}
