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