#include<bits/stdc++.h>
using namespace std;
int main()
{
    freopen("bai2_17.inp","r",stdin);
    freopen("bai2_17.out","w",stdout);
    int64_t k,m,n;
    cin>>k>>m>>n;
    if(n<10000)
    {int64_t s;
    s=(k>m)? m:k;
    int64_t r=0;
    for(int64_t i=s;i<=n;i++)
    {
        if(i%m==0 || i%k ==0)
        {
            r++;
        }
    }
    }
    else
    {
            r=n/m +n/k -n/(k*m);
    }
    cout<<r;
}
