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