l,r,n = map(int,input().split()) dat = [0] * n q = r // n j = r % n qq = (l-1) // n jj = (l-1) % n delta = q - qq for i in range(n): d = 0 if 0 < i <= j: d += 1 if 0 < i <= jj: d -= 1 print(delta + d)