#include <bits/stdc++.h>
using namespace std;
const int MXN = 1e6 + 228;
const int MAXN = 1e3 + 228;
const long long INF = 1e9 + 7;
const long long BINF = 1e15;
const int mod = 1e9 + 7;
const long double EPS = 1e-15;
const long long dx[] = {0, 0, 1, -1};
const long long dy[] = {1, -1, 0, 0};
int n;
int p[MXN];
int ans;
int lvl[MXN];
int sum[MXN];
int main() {
  cin >> n;
  for (int i = 2; i <= n; i++) {
    cin >> p[i];
    lvl[i] = lvl[p[i]] + 1;
    sum[lvl[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    ans += sum[i] % 2;
  }
  ans++;
  cout << ans;
  return 0;
}
