#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  int temp;
  while (b) {
    temp = b;
    b = a % b;
    a = temp;
  }
  return a;
}
int main() {
  int n, m, z, lcm;
  while (cin >> n >> m >> z) {
    if (n < m) swap(n, m);
    int g = gcd(n, m);
    lcm = (n * m) / g;
    int ans = z / lcm;
    cout << ans << endl;
  }
  return 0;
}
