#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, z;
  while (scanf("%d %d %d", &n, &m, &z) != EOF) {
    int s1 = n, s2 = m;
    while (s1 != 0) {
      int a = s2 % s1;
      s2 = s1;
      s1 = a;
    }
    printf("%d\n", z / (m * n / s2));
  }
}
