#include <bits/stdc++.h>
long long a, b, k, m = 2, q;
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
inline long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
inline long long count(long long a, long long b) {
  long long tot = 0;
  for (long long x = a, mx, i; x > b; x -= mx, tot++)
    for (i = k, mx = 1; i >= 2 && mx < i - 1; i--)
      if (x - x % i >= b) mx = (mx < x % i ? x % i : mx);
  return tot;
}
int main() {
  scanf("%I64d %I64d %I64d", &a, &b, &k);
  for (long long i = 3; i <= k; i++) m = lcm(m, i);
  q = (a - b) / m;
  printf("%I64d\n", q * count(m, 0) + count(a - q * m, b));
  return 0;
}
