a=[int(i) for i in input().split()] b=[] for i in range(a[0],a[1]+1): if i%a[2] not in b: b.append(i%a[2]) print(len(b))