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