import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int M = sc.nextInt(); int N = sc.nextInt(); int count=0; while(M!=N){ if(M>N){ M-=N; count++; }else{ int t=M; M=N; N=t; count++; } } System.out.println(count); } }