#include <bits/stdc++.h>
using namespace std;
int level[100005], curr[100005];
int main() {
  long long n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int x;
    cin >> x;
    curr[i] = curr[x] + 1;
    level[curr[i]]++;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += level[i] % 2;
  cout << ans + 1 << endl;
  return 0;
}
