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