#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
vector<int> vc[N + 10];
int p[N + 10], fl[N + 10];
int main() {
  ios_base::sync_with_stdio(false);
  int n, ans = 1;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int p;
    cin >> p;
    fl[i] = fl[p] + 1, vc[fl[i]].push_back(i);
  }
  for (int i = 1; i <= n; i++) ans += (int)vc[i].size() % 2;
  cout << ans;
  return 0;
}
