l, r, m = map(int, input().split()) ll = [] for i in range(l, r+1): if i % m not in ll: ll.append(i % m) ll = list(set(ll)) print(len(ll))