#include <bits/stdc++.h>
using namespace std;
int main()
{
	freopen("bai2_17.inp", "r", stdin);
	freopen("bai2_17.out", "w", stdout);
 	int k,m,n;
 	cin>>k>>m>>n;
 	int x=k, y=m;
 	int temp;
 	while(m!=0)
 	{
 		temp=k%m;
 		k=m;
 		m=temp;
	}
	int bcnn= (x*y)/k;
	int a= (n-n%x)/x;
	int b= (n-n%y)/y;
	int c= (n-n%bcnn)/bcnn;
	int d= a+b-c;
	cout<<d;
}

