#include <bits/stdc++.h>
int gcd(int a, int b) {
  if (b < a) std::swap(a, b);
  return b == 0 ? a : gcd(b, a % b);
}
int main() {
  int a, b, c, cnt = 0;
  scanf("%d %d %d", &a, &b, &c);
  for (int i = a; i <= b; i++)
    if (gcd(c, i) >= a) cnt++;
  printf("%d\n", cnt);
  return 0;
}
