#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, l, x, y;
    cin>>a>>b>>l;
    int contain[l];
    for(int za = 0; za<l; za++)
    {
        contain[za]=0;
    }
    for(int i = 1; i<l+1; i++)
    {
        int k = i;
        if(k==k/a*a)
        {
            x = k/a;
            for(int h = k; h>a-1; h--)
            {
                if(h/a*a == h)
                {
                    if(h/b*b == h && h != k)
                    {
                        contain[h] = 1;
                    }
                }
            }
        }
    }
    int broi = 0;
    for(int sheeesh = 0; sheeesh < l; sheeesh++)
    {
        if(contain[sheeesh] = 0)
        {
            broi++;
        }
    }
    cout<<broi;
    return 0;
}
