#include <bits/stdc++.h>
using namespace std;
int n, m, z;
int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); }
int main() {
  cin >> n >> m >> z;
  cout << (z / ((long long)n * m / gcd(n, m)));
  return 0;
}
