import java.util.Scanner; class no526{ public static void main(String[] args) { Scanner stdIn=new Scanner(System.in); long n=stdIn.nextLong(),m=stdIn.nextLong(),a[]=new long[3]; int i,j; for(i=0;i<2;i++) a[i]=i; if(2>n) System.out.print(0); else if(3>n) System.out.print(1); else { for(i=2;i