#include using namespace std; bool d[1000000000]; int main() { int l, r, m; cin >> l >> r >> m; for (int i = l; i <= r; ++i) { d[i % m] |= true; } int c = 0; for (int i = 0; i < 1000000000; ++i) { if (d[i]) c++; } cout << c << endl; return 0; }