#include <bits/stdc++.h>
using namespace std;
int IT_MAX = 1 << 19;
int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
bool cmp(int a, int b) { return a > b; }
int main() {
  int n;
  int c[100005];
  int s[100005];
  int a[100005];
  memset(a, 0, sizeof(a));
  ;
  memset(s, 0, sizeof(s));
  ;
  scanf("%d", &n);
  ;
  for (int i = 2; i <= n; i++) {
    scanf("%d", &c[i]);
    ;
    s[i] = c[i];
  }
  a[1] = 1;
  for (int i = 2; i <= n; i++) {
    a[i] = a[c[i]] + 1;
  }
  memset(s, 0, sizeof(s));
  for (int i = 2; i <= n; i++) {
    s[a[i]]++;
  }
  int sum = 1;
  for (int i = 1; i <= n; i++) {
    if (s[i] != 0 && s[i] % 2 == 1) {
      sum++;
    }
  }
  printf("%d", sum);
}
