#include <fstream>

using namespace std;

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

long long GCD(long long a, long long b)
{
	return (b == 0) ? a : GCD(b, a % b);
}

int main()
{
	long long n, m, k;
	input >> k >> m >> n;
	long long gcd = GCD(k, m);
	gcd = (k * m) / gcd;
	
	output << n / k + n / m - n / gcd;
	input.close();
	output.close();
	return 0;
}