#include <bits/stdc++.h>
using namespace std;
ifstream in("qq.in");
ofstream out("qq.out");
int v[100005];
int sec[100005];
int Final[100005];
int salam[100005];
int main() {
  cin.sync_with_stdio(false);
  int n, nr, rez = 1;
  cin >> n;
  for (int i = 2; i <= n; i++) cin >> v[i];
  for (int i = 2; i <= n; i++) {
    nr = 1;
    int copie = v[i];
    if (Final[v[i]] == 0) {
      while (copie != 1) {
        if (Final[v[copie]] != 0) {
          nr = Final[v[copie]] + 1;
          break;
        }
        copie = v[copie];
        nr++;
      }
      sec[i] = nr;
      Final[v[i]] = nr;
    } else
      sec[i] = Final[v[i]];
    salam[sec[i]]++;
  }
  for (int i = 1; i <= 100005; i++) {
    if (salam[i] == 0) break;
    if (salam[i] % 2 == 1) rez++;
  }
  cout << rez;
  return 0;
}
