import java.util.Scanner;
public class Main{
public static void main(String[] agrs){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int res=0;
for(int i=1;i<n;i++){
if(i*i%n*2<n)
res++;
}
System.out.println(res);
}
}