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