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