#include<fstream>
#include<vector>
using namespace std;
ifstream fi("BAI2_17.inp");
ofstream fo("BAI2_17.out");
int main()
{
	int d=0;
	int m,n,a;
	fi>>m>>n>>a;
	vector <int> e(a+1,0);
	for(int i=m;i<=a;i+=m)
	{
		e[i]=1;
		d++;
	}
	for(int j=n;j<=a;j+=n)
	{
		if(e[j]==0) d++;
	}
	fo<<d;
	fi.close();
	fo.close();
}
