#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, z;
  int p;
  int temp, r;
  scanf("%d%d%d", &n, &m, &z);
  if (n < m) {
    temp = n;
    n = m;
    m = temp;
  }
  p = n * m;
  while (m != 0) {
    r = n % m;
    n = m;
    m = r;
  }
  temp = p / n;
  int ans;
  ans = z / temp;
  cout << ans << endl;
  return 0;
}
