using System;
using System.Linq;

class aizu_judge
{
    static void Main()
    {
        while(true)
        {
            int count = 0;
            int[] num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (num[2] % num[0] == 0)
                count++;
            if (num[2] % num[1] == 0)
                count++;
            Console.WriteLine(count);
        }

    }
}