#include <bits/stdc++.h>
const long long MAXsz = 1e4 + 5;
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long mod(long long a, long long b) {
  if (a > b)
    return (a - b);
  else
    return (b - a);
}
double distance(long long x1, long long y1, long long x2, long long y2) {
  return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2) * 1.0);
}
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
bool palindrome(string s, long long i, long long j) {
  if (i > j) return true;
  if (s[i] != s[j])
    return false;
  else
    return palindrome(s, i + 1, j - 1);
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
vector<vector<long long>> vec;
vector<bool> visited;
vector<long long> level;
map<long long, long long> mp;
void bfs(long long root) {
  queue<long long> que;
  que.push(root);
  visited[root] = true;
  while (!que.empty()) {
    long long r = que.front();
    que.pop();
    visited[r] = true;
    for (long long i = 0; i < vec[r].size(); i++) {
      if (!visited[vec[r][i]]) {
        que.push(vec[r][i]);
        level[vec[r][i]] = level[r] + 1;
        mp[level[r] + 1]++;
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long n;
  cin >> n;
  vec.resize(n + 1);
  visited.resize(n + 1);
  level.resize(n + 1);
  for (long long i = 2; i <= n; i++) {
    long long x;
    cin >> x;
    vec[x].push_back(i);
    vec[i].push_back(x);
  }
  level[1] = 1;
  mp[1] = 1;
  for (long long i = 0; i < n + 1; i++) visited[i] = false;
  bfs(1);
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) {
    if (mp[i] % 2 != 0) cnt++;
  }
  cout << cnt << "\n";
  return 0;
}
