#include <bits/stdc++.h>
using namespace std;
int a[100000];
int main() {
  int n, m, z;
  scanf("%d%d%d", &n, &m, &z);
  memset(a, 0, sizeof(a));
  for (int i = 1; i * n <= z || i * m <= z; i++) {
    if (i * n <= z) a[i * n]++;
    if (i * m <= z) a[i * m]++;
  }
  int ans = 0;
  for (int i = 1; i <= z; i++) {
    if (a[i] == 2) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
