#include<bits/stdc++.h> using namespace std; int ans=1,a,b; int main(){ cin>>a>>b; while(a!=b){ if(a>b) a-=b; else b-=a; ans++; } cout<<ans; return 0; }