#include <bits/stdc++.h>
int main() {
  int a, b, c, d, f, z = 0, i = -1, x[10000], max = 0, s[10000], j = -1, h = 0,
                     k = 0;
  scanf("%d%d%d", &a, &b, &c);
  int l = 1, r = 1;
  while (h <= c) {
    h = b * l;
    if (h > c) {
      break;
    }
    i++;
    x[i] = h;
    l++;
  }
  while (k <= c) {
    k = a * r;
    if (k > c) break;
    j++;
    s[j] = k;
    r++;
  }
  for (d = 0; d <= i; d++) {
    for (f = 0; f <= j; f++) {
      if (x[d] == s[f]) {
        max++;
      }
    }
  }
  printf("%d\n", max);
  return 0;
}
