#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, b, ans = 0, f[maxn], d[maxn], a[maxn];
vector<int> p[maxn];
void dfs(int x) {
  for (int i = 0; i < (int)p[x].size(); i++) {
    if (p[x][i] == f[x]) continue;
    d[p[x][i]] = d[x] + 1;
    a[d[p[x][i]]]++;
    dfs(p[x][i]);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++)
    scanf("%d", &f[i]), p[f[i]].push_back(i), p[i].push_back(f[i]);
  dfs(1);
  for (int i = 1; i <= n; i++) ans += (a[i] % 2);
  printf("%d\n", ans + 1);
  return 0;
}
