#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, z;
  scanf("%d %d %d", &n, &m, &z);
  set<int> Ilia;
  int k = 1;
  while (k * n <= z) {
    Ilia.insert(k * n);
    k++;
  }
  vector<int> artist;
  k = 1;
  while (k * m <= z) {
    artist.push_back(k * m);
    k++;
  }
  int sz = artist.size();
  int cnt = 0;
  for (int i = 0; i < sz; i++) {
    if (Ilia.find(artist[i]) != Ilia.end()) cnt++;
  }
  printf("%d\n", cnt);
  return 0;
}
