L,R,M = map(int,input().split()) remainders = set() for num in range(L,R + 1): remainders.add(num % M) print(len(remainders))