#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double EPS = 1e-10;
int prv[101010];
int dist[101010];
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  unordered_map<int, int> mp;
  prv[1] = 1;
  for (int i = 2; i <= n; ++i) {
    cin >> prv[i];
    dist[i] = dist[prv[i]] + 1;
    mp[dist[i]]++;
  }
  int ans = 1;
  for (auto &p : mp) {
    ans += p.second % 2;
  }
  cout << ans << "\n";
}
