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