low_num, high_num, num = map(int, input().split()) li = [] for i in range(low_num, high_num + 1): li.append(i % num) li = set(li) print(len(li))