#include <bits/stdc++.h>
using namespace std;
int ucln (int a, int b)
{
	int c;
	while (b!=0)
	{
		c=a%b;
		a=b;
		b=c;
	}
	return a;
}
int boiChung (int x, int y)
{
	int d;
	d=(x*y)/ucln (x,y);
	return d;
		
}
int main()
{
	ifstream f1("BAI2_17.INP");
	ofstream f2("BAI2_17.OUT");
	int k;
	int m;
	int n;
	f1>>k>>m>>n;
	int a=(n-(n%k))/k;
	int b=(n-(n%m))/m;
	int c=(n-(n%boiChung(k,m)))/boiChung(k,m);
	int dem=a+b-c;
	f2<<dem;
	f1.close();
	f2.close();
}
