#include <bits/stdc++.h>
using namespace std;
int pwr(int base, int p) {
  int ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base) % 1000000007;
    base = (base * base) % 1000000007;
    p /= 2;
  }
  return ans;
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int powr(int base, int p) {
  int ans = 1;
  while (p) {
    if (p & 1) ans = (ans * base);
    base = (base * base);
    p /= 2;
  }
  return ans;
}
vector<int> g[100005];
vector<int> w[100005];
int wid = 0;
void dfs(int c, int p, int d) {
  wid = max(wid, d);
  w[d].push_back(c);
  int l = g[c].size();
  for (int i = 0; i < l; i++) {
    if (g[c][i] != p) {
      dfs(g[c][i], c, d + 1);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (2); i < (n + 1); ++i) {
    int x;
    scanf("%d", &x);
    g[x].push_back(i);
  }
  dfs(1, 0, 1);
  int ans1 = 1;
  for (int i = 1; i <= wid - 1; i++) {
    int l = w[i].size();
    int ans = 0;
    for (int j = 0; j < l; j++) {
      int ch = g[w[i][j]].size();
      ans += ch;
    }
    if (ans & 1) ans1 += 1;
  }
  printf("%d\n", ans1);
}
