#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(__int128_t &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(__int128_t x){
  int s=0;
  int m=0;
  char f[40];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
template<class T> inline T pow2_L(T a){
  return a*a;
}
int main(){
  __int128_t R;
  rd(R);
  __int128_t X;
  rd(X);
  __int128_t Y;
  rd(Y);
  __int128_t res;
  if((pow2_L(X))+(pow2_L(Y))==(pow2_L(R))){
    wt_L(1);
    wt_L('\n');
    return 0;
  }
  __int128_t Lj4PdHRW;
  __int128_t KL2GvlyY;
  __int128_t Q5VJL1cS;
  Lj4PdHRW = 0;
  KL2GvlyY = 1000000;
  while(Lj4PdHRW < KL2GvlyY){
    if((Lj4PdHRW + KL2GvlyY)%2==0){
      Q5VJL1cS = (Lj4PdHRW + KL2GvlyY) / 2;
    }
    else{
      Q5VJL1cS = (Lj4PdHRW + KL2GvlyY - 1) / 2;
    }
    if((pow2_L(X))+(pow2_L(Y))<=(pow2_L((Q5VJL1cS*R)))){
      KL2GvlyY = Q5VJL1cS;
    }
    else{
      Lj4PdHRW = Q5VJL1cS + 1;
    }
  }
  res =KL2GvlyY;
  if(res==1){
    res = 2;
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay version 20210405-1

// --- original code ---
// {
//   __int128_t @R, @X, @Y, res;
//   if(X**2 + Y**2 == R**2) wt(1), return 0;
//   res = bsearch_min[__int128_t,c,0,1d6](X**2+Y**2 <= (c*R)**2);
//   if(res==1) res = 2;
//   wt(res);
// }

#include <stdio.h>
#include <algorithm>
#include <vector>
#define MN 100000

int n;
std::vector<int> e[MN+5];

void add(int u,int v){
	e[u].push_back(v);
}

struct state{
	int c,f,s;
}s[MN+5];

void dfs(int u){
	s[u].c = 1;
	s[u].f = 1;
	s[u].s = 0;
	std::vector<int> ve[2];
	for(auto v:e[u]){	
		dfs(v);
		s[u].c += s[v].c;
		if(s[v].c&1){
			ve[1].push_back(v);
		}else{
			if(s[v].s>=s[v].f){
				s[u].s += s[v].s;
				s[u].f += s[v].f;
			}else{
				ve[0].push_back(v);
			}
		}
	}
	std::sort(ve[1].begin(),ve[1].end(),[](int a,int b)->bool{
		return s[a].s-s[a].f>s[b].s-s[b].f;
	});
	for(int i=0;i<(int)ve[1].size();i++){
		int v = ve[1][i];
		if(i&1){
			s[u].f += s[v].s;
			s[u].s += s[v].f;
		}else{
			s[u].s += s[v].s;
			s[u].f += s[v].f;
		}
	}
	if(ve[1].size()&1){
		for(auto v:ve[0]){
			s[u].f += s[v].s;
			s[u].s += s[v].f;
		}
	}else{
		for(auto v:ve[0]){
			s[u].s += s[v].s;
			s[u].f += s[v].f;
		}
	}
}

int main(){
	scanf("%d",&n);
	for(int i=2,f;i<=n;i++){
		scanf("%d",&f);
		add(f,i);
	}
	dfs(1);
	printf("%d\n",s[1].f);
}