#include<iostream>
#include<algorithm>
using namespace std;

int nod(int a, int b) {
    if (a < b) {
        int temp = a;
        a = b;
        b = temp;
    }

    while (b != 0) {
        int temp = a;
        a = b;
        b = temp % b;

    }
    return a;
}

int nok(int a, int b) {
    return a * b / nod(a, b);
}

int main () {
    ios_base::sync_with_stdio(false);
    int a, b, l;
    cin >> a >> b >> l;
    if (a > b) {
        int temp = a;
        a = b;
        b = temp;
    }

    int ans = 0;
    for (int i = 1; i <= l; i++) {
        if (i % a == 0 || i % b == 0) {
            if (i >= min(a, b) + nok(a, b)) {
                continue;
            } else {
//                cout << i << " ";
                ans++;
                continue;
            }
        }
        if ((i % a) % (b % a) == 0 && (i / a) > b / a) {
            continue;
        } else {
//            cout << i << " ";
            ans++;
            continue;
        }
    }
    cout << ans;
}
