function main(input) {
  let args = input.split(/\s/);
  let result = 0;
  for (let i = 0;i <= args[1] - args[0];i++) {
    if ((i + (args[0] * 1)) % args[2]) {
      result++
    }
  }
  console.log(result);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));