#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  int t;
  while (b) t = a, a = b, b = t % a;
  return a;
}
int main() {
  int n, m, z;
  scanf("%d%d%d", &n, &m, &z);
  int lcm = n * m / gcd(n, m);
  printf("%d\n", z / lcm);
  return 0;
}
