#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int main() {
  int n, m, z;
  cin >> n >> m >> z;
  int r = gcd(n, m);
  r = n * m / r;
  int i;
  for (i = 1;; i++) {
    if (r * i > z) {
      break;
    }
  }
  cout << i - 1 << endl;
}
