#include <fstream>

using namespace std;

ifstream input("Bai2_17.inp");
ofstream output("Bai2_17.out");

int main()
{
	long long n, m, k;
	input >> k >> m >> n;
	long long res = 0;
	for (long long i = 1; i <= n; ++i)
	{
		if (i % m == 0 || i % k == 0)
		{
			res++;
		}
	}
	output << res;
	input.close();
	output.close();
	return 0;
}