#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int SIZE = 100000005;
const int Size = 100005;
const int MOD = 1000000007;
const double PI = 2 * acos(0.0);
const long long INF = 214738360000;
map<int, int> mymap;
int main() {
  int n, m, z, res, ans, count = 0, i;
  cin >> n >> m >> z;
  for (i = n; i <= z; i += n) {
    mymap[i]++;
  }
  for (i = m; i <= z; i += m) {
    mymap[i]++;
  }
  map<int, int>::iterator it;
  for (it = mymap.begin(); it != mymap.end(); it++) {
    if (it->second == 2) count++;
  }
  cout << count << endl;
  return 0;
}
