#include <bits/stdc++.h>
using namespace std;
long long int i, j, n, m, k, d, x, y, z, t, a[100001], b[100001], mark[100001];
float f;
char c1, c2, c3;
string s1, s2, s3;
int gcd(int q, int w) {
  int eb;
  if (q > w)
    eb = q;
  else
    eb = w;
  for (int i = eb; i > 0; --i) {
    if (q % i == 0 and w % i == 0) return i;
  }
}
int main() {
  scanf("%d %d %d", &n, &m, &z);
  k = n * m / gcd(n, m);
  n = k;
  while (k <= z) {
    k += n;
    x++;
  }
  printf("%d\n", x);
  return 0;
}
