#include <bits/stdc++.h>
using std::abs;
using std::cerr;
using std::cin;
using std::cout;
using std::map;
using std::max;
using std::min;
using std::pair;
using std::reverse;
using std::set;
using std::sort;
using std::string;
using std::swap;
using std::vector;
using ll = long long;
struct __init {
  __init() {
    cin.tie(nullptr);
    std::iostream::sync_with_stdio(false);
    cout << std::fixed << std::setprecision(10);
    cerr << std::fixed << std::setprecision(5);
    std::mt19937 rand(300);
  }
  ~__init() {}
} init;
const ll inf = (ll)1e9 + 7ll;
const int maxn = (int)1e6 + 17;
int n;
int cnt[maxn];
vector<int> g[maxn];
bool read() {
  if (!(cin >> n)) return false;
  for (int i = 1; i < n; ++i) {
    int p;
    cin >> p;
    g[p - 1].push_back(i);
  }
  return true;
}
void dfs(int v, int h = 0) {
  ++cnt[h];
  for (auto to : g[v]) dfs(to, h + 1);
}
void solve() {
  dfs(0);
  int ans = 0;
  for (int i = 0; i < n; ++i) ans += cnt[i] % 2;
  cout << ans << '\n';
}
int main() {
  while (read()) solve();
  return 0;
}
