#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, x, gcd, lcm, z, c;
  cin >> a >> b >> z;
  if (a < b) {
    x = a;
  } else {
    x = b;
  }
  for (int i = x; i > 0; i--) {
    if (a % i == 0 && b % i == 0) {
      gcd = i;
      break;
    }
  }
  lcm = (a * b) / gcd;
  c = z / lcm;
  cout << c;
  return 0;
}
