#include <bits/stdc++.h>
using namespace std;
using namespace std;
const double EPS = 1e-9;
const int INF = 0x7f7f7f7f;
const double PI = acos(-1.0);
template <class T>
inline T gcd(T a, T b) {
  return (b) == 0 ? (a) : gcd((b), ((a) % (b)));
}
template <class T>
inline T lcm(T a, T b) {
  return ((a) / gcd((a), (b)) * (b));
}
template <typename T>
string NumberToString(T Number) {
  ostringstream second;
  second << Number;
  return second.str();
}
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
int n, a[100004];
map<int, int> tt;
vector<vector<int> > adj;
int vis[100004];
void dfs(int u, int t) {
  tt[t]++;
  vis[u] = 1;
  for (auto v : adj[u]) {
    if (vis[v] == 0) {
      dfs(v, t + 1);
    }
  }
}
int main() {
  while (~scanf("%d", &n)) {
    tt.clear();
    adj.assign(n + 4, vector<int>());
    for (int i = (int)(2); i <= (int)(n); i++) {
      scanf("%d", &a[i]);
      adj[a[i]].push_back(i);
    }
    memset(vis, 0, sizeof(vis));
    dfs(1, 0);
    int res = 0;
    for (int i = (int)(0); i <= (int)(100000); i++) {
      if (tt[i] % 2 == 1) res++;
    }
    printf("%d\n", res);
  }
  return 0;
}
