#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, z, cnt = 0;
  cin >> n >> m >> z;
  vector<int> call, artist;
  for (int i = 1; i <= z; i++) {
    int x = i * n;
    if (x <= z) call.push_back(x);
    x = i * m;
    if (x <= z) artist.push_back(x);
  }
  int j = 0;
  for (int i = 0; i < artist.size(); i++) {
    for (j; j < call.size(); j++) {
      if (call[j] > artist[i])
        break;
      else if (call[j] == artist[i]) {
        cnt++;
        break;
        j++;
      } else
        continue;
    }
  }
  cout << cnt << endl;
  return 0;
}
