#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, z, n1, m1;
  int a[10000], b[10000];
  int g, j, k, p = 0;
  int count = 0;
  cin >> n >> m >> z;
  n1 = n;
  m1 = m;
  if (z <= 10000 && z > 0 && n >= 1 && m >= 1) {
    while (n <= z || m <= z) {
      a[j] = n;
      n = n + n1;
      j++;
      b[g] = m;
      m = m + m1;
      g++;
    }
    for (k = 0; k < j; k++) {
      for (p = 0; p < g; p++) {
        if (a[k] == b[p]) {
          count++;
        }
      }
    }
    cout << count;
    return 0;
  }
}
