Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taymyr from Ilia-alpinist.

Ilia-alpinist calls every n minutes, i.e. in minutes n, 2n, 3n and so on. Artists come to the comrade every m minutes, i.e. in minutes m, 2m, 3m and so on. The day is z minutes long, i.e. the day consists of minutes 1, 2, ..., z. How many artists should be killed so that there are no artists in the room when Ilia calls? Consider that a call and a talk with an artist take exactly one minute.


-----Input-----

The only string contains three integers — n, m and z (1 ≤ n, m, z ≤ 10^4).


-----Output-----

Print single integer — the minimum number of artists that should be killed so that there are no artists in the room when Ilia calls.


-----Examples-----
Input
1 1 10

Output
10

Input
1 2 5

Output
2

Input
2 3 9

Output
1



-----Note-----

Taymyr is a place in the north of Russia.

In the first test the artists come each minute, as well as the calls, so we need to kill all of them.

In the second test we need to kill artists which come on the second and the fourth minutes.

In the third test — only the artist which comes on the sixth minute.

Source: codeforces | Difficulty: EASY
Tags: Mathematics

Implementation

Complete search


Solutions:
import math
(n, m, z) = map(int, input().split())
x = n * m // math.gcd(n, m)
k = max(m, n)
l = min(m, n)
if k % l == 0:
	print(z // k)
else:
	print(z // x)


import math
(n, m, z) = [int(x) for x in input().split(' ')]
print(z // (n * m // math.gcd(n, m)))


(n, m, z) = map(int, input().split())
c = 0
for _ in range(1, z + 1):
	if _ % n == 0 and _ % m == 0:
		c += 1
print(c)


vv = [int(x) for x in input().split()]
n = vv[0]
m = vv[1]
z = vv[2]
if n == 1:
	print(z // m)
else:
	sp1 = [int(k) for k in range(n, z + 1, n)]
	sp11 = set(sp1)
	sp2 = [int(d) for d in range(m, z + 1, m)]
	sp22 = set(sp2)
	res = sp11.intersection(sp22)
	print(len(res))


(n, m, z) = map(int, input().split())
c = [n * i for i in range(1, z + 1) if n * i <= z]
a = [m * i for i in range(1, z + 1) if m * i <= z]
q = 0
for i in c:
	if i in a:
		q += 1
print(q)


(n, m, z) = map(int, input('').split())
s = 0
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		s += 1
print(s)


from math import gcd
(n, m, z) = map(int, input().split())
lcm = n * m // gcd(n, m)
print(z // lcm)


(n, m, z) = map(int, input().split())

def gcd(n, m):
	if m == 0:
		return n
	else:
		return gcd(m, n % m)
lcm = int(m * n / gcd(m, n))
print(int(z / lcm))


(a, b, c) = map(int, input().split())
from math import ceil as z
s = list((i * a for i in range(1, z((c + 1) / a))))
s1 = list((i * b for i in range(1, z((c + 1) / b))))
print(len(s) + len(s1) - len(set(s + s1)))


import math
(n, m, z) = list(map(int, input().split()))
g = n * m // math.gcd(n, m)
if n == 1:
	g = m
if m == 1:
	g = n
print(z // g)


def rec(n, z, l, x, y):
	if n > z:
		return l
	elif n == z:
		l.append(n)
		return l
	else:
		if n not in l:
			l.append(n)
		rec(n * x, z, l, x, y)
		rec(n * y, z, l, x, y)

def gcd(x, y):
	if x < y:
		(x, y) = (y, x)
	if y == 0:
		return x
	return gcd(y, x % y)

def lcm(x, y):
	if x < y:
		(x, y) = (y, x)
	gcd_ = gcd(x, y)
	return x * y // gcd_

def main_func():
	(x, y, z) = [int(i) for i in input().split(' ')]
	count = 0
	for i in range(1, z + 1):
		if not i % x and (not i % y):
			count += 1
	return count
print(main_func())


(n, m, d) = map(int, input().split())
print(len(set([n * i for i in range(1, d // n + 1)]).intersection([m * i for i in range(1, d // m + 1)])))


(n, m, z) = map(int, input().split(' '))
(i, j, count) = (1, 1, 0)
while i * n <= z:
	if j * m > i * n:
		i += 1
		continue
	elif j * m < i * n:
		j += 1
	else:
		count += 1
		i += 1
print(count)


(n, m, z) = list(map(int, input().split()))
d = 0
for i in range(n, z + 1, n):
	if i % m == 0:
		d += 1
print(d)


nmz = list(map(int, input().split()))

def f(a, b):
	if b == 0:
		return a
	else:
		return f(b, a % b)
u = nmz[1] * (nmz[0] / f(nmz[1], nmz[0]))
print(int(nmz[2] / u))


I = input().split(' ')
n = int(I[0])
m = int(I[1])
z = int(I[2])
cnter = 0
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		cnter += 1
print(cnter)


(n, m, z) = list(map(int, input().split()))
print(sum((1 for t in range(1, z + 1) if t % n == 0 and t % m == 0)))


(n, m, z) = map(int, input().split())
(n1, m1) = (n, m)
kill = 0
while n1 <= z and m1 <= z:
	if n1 == m1:
		n1 += n
		m1 += m
		kill += 1
	elif n1 < m1:
		n1 += n
	else:
		m1 += m
print(kill)


n = list(map(int, input().split()))
a = set()
b = set()
for i in range(n[2] // n[0]):
	a.add((i + 1) * n[0])
for i in range(n[2] // n[1]):
	b.add((i + 1) * n[1])
print(len(a & b))


[a, b, c] = [int(x) for x in input().split()]

def usg(a, b):
	if a == 0 or b == 0:
		return a + b
	if a > b:
		return usg(b, a % b)
	else:
		return usg(a, b % a)
print(c // (a * b // usg(a, b)))


from fractions import gcd
(n, m, z) = [int(x) for x in input().split()]
lcm = n * m // gcd(n, m)
print(z // lcm)


import math

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
(n, m, z) = map(int, input().split())
b = lcm(n, m)
t = z // b
print(t)


def main():
	(m, n, z) = [int(v) for v in input().split()]
	c = 0
	for i in range(1, z + 1):
		if i % m == 0 and i % n == 0:
			c += 1
	print(c)
main()


(n, m, z) = map(int, input().split())

def lcd(a, b):
	while a and b:
		if a > b:
			a %= b
		else:
			b %= a
	return a + b

def lcm(a, b):
	return a * b / lcd(a, b)
print(int(z // lcm(m, n)))


import sys
import re
import math
import itertools
import collections
import bisect
mod = 1000000007
pi = 3.141592653589793
IS = float('inf')
xy = [(1, 0), (-1, 0), (0, 1), (0, -1)]
bs = [(-1, -1), (-1, 1), (1, 1), (1, -1)]

def niten(a, b):
	return abs(a - b) if a >= 0 and b >= 0 else a + abs(b) if a >= 0 else abs(a) + b if b >= 0 else abs(abs(a) - abs(b))

def fib(n):
	return [(seq.append(seq[i - 2] + seq[i - 1]), seq[i - 2])[1] for seq in [[0, 1]] for i in range(2, n)]

def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def eucl(x1, y1, x2, y2):
	return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

def choco(xa, ya, xb, yb, xc, yc, xd, yd):
	return 1 if abs((yb - ya) * (yd - yc) + (xb - xa) * (xd - xc)) < 1e-10 else 0

def pscl(num, l=[1]):
	for i in range(num):
		l = map(lambda x, y: x + y, [0] + l, l + [0])
	return l
(n, m, z) = map(int, input().split())
print(z // lcm(max(n, m), min(n, m)))


import sys

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
(n, m, z) = map(int, input().split())
lcm = n * m // gcd(n, m)
print(z // lcm)


(n, m, z) = map(int, input().split())
artist = []
killer = []
total = 0
for x in range(n, z + 1, n):
	artist.append(x)
for x in range(m, z + 1, m):
	killer.append(x)
for y in killer:
	if y in artist:
		total += 1
print(total)


import sys
read = lambda : sys.stdin.readline().strip()
write = lambda x: sys.stdout.write(str(x) + '\n')
(n, m, z) = map(int, read().split())
ns = {i for i in range(n, z + 1, n)}
ms = {i for i in range(m, z + 1, m)}
ans = len(ns & ms)
write(ans)


(n, m, z) = map(int, input().split(' '))

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
print(z // lcm(n, m))


import sys

def check(n, m, z):
	count = 0
	xn = n
	xm = m
	while xn <= z or xm <= z:
		if xn == xm:
			count += 1
			xn += n
			xm += m
		elif xn < xm:
			xn += n
		else:
			xm = xm + m
	return count

def main():
	(n, m, z) = map(int, sys.stdin.readline().split())
	print(check(n, m, z))
main()


(n, m, z) = map(int, input().split())
l1 = set()
l2 = set()
for i in range(n, z + 1, n):
	l1.add(i)
for j in range(m, z + 1, m):
	l2.add(j)
print(len(l1 & l2))


R = lambda : map(int, input().split())
(a, b, n) = R()
c = 0
for i in range(1, n + 1):
	if i * a <= n:
		if i * a % b == 0:
			c += 1
	else:
		break
print(c)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_int = lambda : int(sys.stdin.readline().strip())
pt = lambda x: sys.stdout.write(str(x))
(n, m, z) = get_list()
lcm = n * m // math.gcd(n, m)
print(z // lcm)


(n, m, z) = map(int, input().split())

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	elif a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)
g = gcd(n, m)
lc = n * m // g
print(z // lc)


(a, b, c) = map(int, input().split())
d = []
e = []
i = 1
while i < c + 1:
	if i % a == 0:
		d.append(i)
	if i % b == 0:
		e.append(i)
	i += 1
print(len(d) + len(e) - len(set(d + e)))


(n, m, z) = list(map(int, input().split()))
n1 = []
m1 = []
temp = n
while n <= z:
	n1.append(n)
	n = n + temp
temp = m
while m <= z:
	m1.append(m)
	m += temp
final = list(set(n1) & set(m1))
print(len(final))


(n, m, z) = map(int, input().split())
ans = 0
for x in range(1, z + 1):
	if x % m == 0 and x % n == 0:
		ans += 1
print(ans)


z = list(map(int, input().split()))
a = []
b = []
temp = 1
count = 1
while temp <= z[2]:
	temp = count * z[0]
	if temp <= z[2]:
		a.append(temp)
	count += 1
temp = 1
count = 1
while temp <= z[2]:
	temp = count * z[1]
	if temp <= z[2]:
		b.append(temp)
	count += 1
count = 0
for i in b:
	if i in a:
		count += 1
print(count)


(n, m, z) = map(int, input().split())
l = []
l1 = []
for i in range(1, z + 1):
	x = m * i
	y = n * i
	if x <= z:
		l.append(x)
	if y <= z:
		l1.append(y)
cnt = 0
for j in l:
	if j in l1:
		cnt += 1
print(cnt)


def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
arr = [int(x) for x in input().split()]
k = lcm(arr[0], arr[1])
print(arr[2] // k)


(n, m, z) = map(int, input().split())

def gcd(a, b):
	q = a % b
	if q:
		return gcd(b, q)
	else:
		return b
print(z // (n * m // gcd(n, m)))


def gcd(a, b):
	if a == 0:
		return b
	elif a > b:
		tmp = a
		a = b
		b = tmp
	return gcd(min(a, b % a), max(a, b % a))
(a, b, c) = map(int, input().split())
k = a * b // gcd(a, b)
print(c // k)


string = input().split(' ')
n = int(string[0])
m = int(string[1])
z = int(string[2])
count = 0
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		count += 1
print(count)


(n, m, z) = map(int, input().split(' '))
l = [i for i in range(1, z + 1) if i % n == 0 and i % m == 0]
print(len(l))


(a, b, c) = [int(i) for i in input().split()]
l = []
s = []
f = 0
for i in range(1, 10001):
	d = a * i
	e = b * i
	if d <= c:
		l.append(d)
	if e <= c:
		s.append(e)
	if d > c and e > c:
		break
for i in range(0, len(l)):
	if l[i] in s:
		f = f + 1
print(f)


def gcd(a, b):
	while a * b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b
(n, m, z) = map(int, input().split())
k = n * m // gcd(n, m)
print(z // k)


(n, m, z) = map(int, input().split())
na = []
ma = []
k = 0
for i in range(1, z + 1):
	if i % n == 0:
		na.append(i)
	if i % m == 0:
		ma.append(i)
for i in na:
	if i in ma:
		k = k + 1
print(k)


(n, m, z) = map(int, input().split())
import math
a = math.gcd(n, m)
a = n * m // a
print(z // a)


import math
f = lambda : map(int, input().split())
(n, m, z) = f()
c = 0
lcm = n * m // math.gcd(n, m)
while lcm * (c + 1) <= z:
	c += 1
print(c)


def calculateArtistsKilled():
	values = input()
	splitInput = values.split()
	m = int(splitInput[0])
	n = int(splitInput[1])
	z = int(splitInput[2])
	illaZ = 0
	artistsZ = 0
	artistsKilled = 0
	isIllaTimeGreater = m > n
	while True:
		illaZ += m
		artistsZ += n
		while artistsZ > illaZ:
			illaZ += m
			if illaZ >= artistsZ:
				break
		while illaZ > artistsZ and isIllaTimeGreater:
			artistsZ += n
			if artistsZ >= illaZ:
				break
		if illaZ > z or artistsZ > z:
			break
		if illaZ == artistsZ:
			artistsKilled += 1
	print(artistsKilled)
calculateArtistsKilled()


(n, m, k) = map(int, input().split())
a = 0
for x in range(1, k + 1):
	if x % n == 0 and x % m == 0:
		a += 1
print(a)


(n, m, z) = map(int, input().split())
list_n = [x * n for x in range(1, z // n + 1)]
list_m = [x * m for x in range(1, z // m + 1)]
count = 0
for item in list_m:
	if item in list_n:
		count += 1
print(count)


(n, m, z) = map(int, input().split())
l = []
l1 = []
kl = 1
while kl * n <= z:
	l.append(kl * n)
	kl = kl + 1
kl = 1
while kl * m <= z:
	l1.append(kl * m)
	kl = kl + 1
k = 0
for i in range(len(l1)):
	if l1[i] in l:
		k = k + 1
print(k)


(a, b, c) = map(int, input().split())
(x, y) = (a, b)
while y:
	(x, y) = (y, x % y)
print(c // (a * b // x))


import math
(n, m, z) = input().split()
a = math.gcd(int(n), int(m))
l = int(n) * int(m) // a
print(int(z) // l)


(a, b, n) = map(int, input().split())
s = 0
for i in range(1, n + 1):
	if i % b == 0 and i % a == 0:
		s += 1
print(s)


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
(n, m, z) = inm()
ans = 0
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		ans += 1
print(ans)


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
(n, m, z) = [int(i) for i in input().split()]
print(z // lcm(m, n))


(x, y, z) = [int(a) for a in input().split()]
a = []
b = []
c = x
d = y
s = 0
h = {}
p = 0
while c <= z or d <= z:
	a.append(c)
	c += x
	b.append(d)
	d += y
for i in a:
	h[i] = p
	p += 1
p = 0
for i in b:
	if i in h:
		p += 1
print(p)


theList = list(map(lambda x: int(x), input().split()))
n = theList[0]
m = theList[1]
z = theList[2]
result = 0
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		result += 1
print(result)


(n, m, z) = map(int, input().split())
ans = 0
if z >= n and z >= m:
	n_list = [n]
	m_list = [m]
	for _ in range(1, z // n):
		n_list.append(n_list[-1] + n)
	for _ in range(1, z // m):
		m_list.append(m_list[-1] + m)
	for el in m_list:
		if el in n_list:
			ans += 1
print(ans)


(n, m, z) = list(map(int, input().split()))
t = []
s = 0
for i in range(1, z + 1):
	if i % n == 0:
		t.append(1)
	else:
		t.append(0)
for i in range(1, z + 1):
	if i % m == 0 and t[i - 1] == 1:
		s = s + 1
print(s)


(n, m, z) = [int(i) for i in input().split()]
c = 0
for i in range(1, z + 1):
	if i % m == 0 and i % n == 0:
		c = c + 1
print(c)


(n, m, z) = tuple(map(int, input().split()))
count = 0
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		count += 1
print(str(count))


(a, b, c) = map(int, input().split())
l = 0
for n in range(1, c + 1):
	if n % a == 0 and n % b == 0:
		l += 1
print(l)


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
(x, y, z) = q()
greater = max([x, y])
while True:
	if greater % x == 0 and greater % y == 0:
		lcm = greater
		break
	greater += 1
print(z // lcm)


(n, m, z) = map(int, input().split())
i = n
num = 0
while i <= z:
	if i % m == 0:
		num += 1
	i += n
print(num)


import sys
fin = sys.stdin
fout = sys.stdout
ans = 0
(n, m, z) = map(int, fin.readline().split())
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		ans += 1
fout.write(str(ans))


import sys
import math

class Solver(object):

	def run(self):
		(n, m, z) = [int(i) for i in input().split(' ')]
		print(int(z / lcm(n, m)))

def gcd(a, b):
	return math.gcd(a, b)

def lcm(a, b):
	return abs(a * b) / gcd(a, b) if a and b else 0
Solver().run()


def gcd(a, b):
	while a != 0:
		temp = b % a
		b = a
		a = temp
	return b

def lcm(a, b):
	p = a * b
	return p / gcd(a, b)
(n, m, z) = map(int, input().split())
lc = lcm(n, m)
print(int(z // lc))


A = list(map(int, input().split()))
n = A[0]
m = A[1]
z = A[2]
if n <= 0 or m <= 0 or z <= 0:
	print('неккоректно')
	exit()
k = 0
view = [i + 1 for i in range(z)]
for i in range(1, z + 1):
	if i % m == 0:
		view[i - 1] = 'танцор'
	if i % n == 0:
		if view[i - 1] == 'танцор':
			k += 1
		view[i - 1] = 'звонок'
print(k)


(a, b, z) = map(int, input().split())
x = a
y = b
answer = 0
while min(x, y) <= z:
	if x == y:
		answer += 1
	if x < y:
		x += a
	else:
		y += b
print(answer)


n = input()
lst = list(map(int, n.split()))
num1 = lst[0]
num2 = lst[1]
num3 = lst[2]
while True:
	if num1 > num2:
		if num1 // num2 == num1 / num2:
			ebob = num2
			break
		num1 = num1 % num2
	else:
		if num2 // num1 == num2 / num1:
			ebob = num1
			break
		num2 = num2 % num1
div = lst[0] * lst[1] / ebob
res = int(num3 / div)
print(res)


import sys
(n, m, z) = map(int, sys.stdin.readline().split())
c = 0
for i in range(1, z + 1):
	if i % n == i % m == 0:
		c += 1
print(c)


(x, y, z) = map(int, input().split())

def intersection(lst1, lst2):
	lst3 = [value for value in lst1 if value in lst2]
	return lst3
i = x
l = []
l1 = []
while i <= z:
	l.append(i)
	i = i + x
j = y
while j <= z:
	l1.append(j)
	j = j + y
z = intersection(l, l1)
print(len(z))


inp = list(map(int, input().split()))
n = inp[0]
m = inp[1]
z = inp[2]
s1 = []
s2 = []
s = []
for i in range(n, z + 1, n):
	s1.append(i)
for i in range(m, z + 1, m):
	s2.append(i)
s = list(set(s1).intersection(s2))
result = len(s)
print(result)


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return abs(a * b) / gcd(a, b)
(n, m, k) = map(int, input().strip().split(' '))
meet = lcm(n, m)
print(int(k / meet))


import math
(a, b, c) = map(int, input().split())
k = a * b // math.gcd(a, b)
t = 0
p = k
while k <= c:
	t += 1
	k += p
print(t)


(n, m, z) = map(int, input().split())
q = 0
ne = n
me = m
for i in range(0, z):
	if ne - 1 <= z and me <= z:
		if me < ne:
			while me < ne:
				me += m
		elif ne < me:
			while ne < me:
				ne += n
		elif ne == me:
			q += 1
			ne += n
			me += m
	else:
		break
print(q)


def main():
	from math import gcd
	[n, m, z] = [int(_) for _ in input().split()]
	lcm = n // gcd(n, m) * m
	print(z // lcm)
main()


(n, m, z) = input().split()
m = int(m)
n = int(n)
z = int(z)
output = 0
n_list = []
m_list = []
if n == m:
	print(z // n)
else:
	for i in range(1, z + 1):
		nn = n * i
		mm = m * i
		if nn <= z:
			n_list.append(nn)
		if mm <= z:
			m_list.append(mm)
	for j in range(len(m_list)):
		for i in range(len(n_list)):
			if m_list[j] == n_list[i]:
				output += 1
	print(output)


line = input().split()

def gcd(a, b):
	while b != 0:
		tmp = a % b
		a = b
		b = tmp
	return a
n = int(line[0])
m = int(line[1])
z = int(line[2])
mcm = n * m / gcd(n, m)
print(max(0, int(z / mcm)))


import math
(n, m, t) = map(int, input().split())
kmm = n * m // math.gcd(n, m)
print(t // kmm)


inp = input()
data = inp.split()
n = int(data[0])
m = int(data[1])
z = int(data[2])
if n <= m:
	lower = n
	upper = m
else:
	upper = n
	lower = m
killed = 0
smallerCount = 0
largerCount = upper
while largerCount <= z:
	while smallerCount <= largerCount:
		if smallerCount == largerCount:
			killed += 1
			break
		smallerCount += lower
	largerCount += upper
print(killed)


(n, m, z) = map(int, input().split())

def gcd(a, b):
	if b == 0:
		return a
	remainder = a % b
	return gcd(b, remainder)

def lcm(a, b):
	return int(a * b / gcd(a, b))
lc = lcm(n, m)
cnt = 0
for i in range(1, z + 1):
	if i % lc == 0:
		cnt += 1
print(cnt)


import fractions
(n, m, z) = map(int, input().split())
print(z // (n * m // fractions.gcd(n, m)))


from fractions import *
(n, m, z) = list(map(int, input().split()))
print(z * gcd(n, m) // n // m)


(n, m, z) = map(int, input().split())
i = 1
n_list = []
while i * n <= z:
	su = i * n
	n_list.append(su)
	i += 1
i = 1
m_list = []
while i * m <= z:
	su = i * m
	m_list.append(su)
	i += 1
co = 0
for i in n_list:
	if i in m_list:
		co += 1
print(co)


(n, m, z) = map(int, input().split())
hi = max(m, n)
ans = 0
for x in range(hi, z + 1, hi):
	if x % n + x % m == 0:
		ans += 1
print(ans)


(call_gap, frequence, day) = map(int, input().split(' '))
count = 0
for i in range(1, day + 1):
	if i % call_gap == 0 and i % frequence == 0:
		count += 1
print(count)


def GCD(a, b):
	if a == 0:
		return b
	else:
		return GCD(b % a, a)

def LCM(a, b):
	return a * b / GCD(a, b)
(a, b, c) = [int(i) for i in input().split()]
print(int(c // LCM(a, b)))


from math import gcd

def array(arr, struc):
	return list(map(struc, arr.split()))

def getLCM(a, b):
	return a * b // gcd(a, b)
arr = array(input(), int)
print(arr[2] // getLCM(arr[0], arr[1]))


(a, b, c) = map(int, input().split())
ans = 0
for i in range(b, c + 1, b):
	if i % a == 0:
		ans += 1
print(ans)


f = 1
C = 0
(n, m, z) = map(int, input().split())
while m * f <= z:
	if m * f % n == 0:
		C += 1
	f += 1
print(C)


(n, m, z) = input().split()
n = int(n)
m = int(m)
z = int(z)
cnt = 0
i = n
while i <= z:
	if i % m == 0:
		cnt = cnt + 1
	i = i + n
print(cnt)


from math import *
(n, m, z) = map(int, input().split())
lcm = m * n // gcd(n, m)
fin = 0
if lcm > z:
	print(0)
else:
	print(z // lcm)


(a, b, n) = input().split()
(a, b, n) = (int(a), int(b), int(n))
c = []
d = []
for i in range(1, n + 1):
	f = i * a
	g = i * b
	if f > n and g > n:
		break
	else:
		c.append(i * a)
		d.append(i * b)
e = set(c) & set(d)
print(len(e))


(n, m, z) = list(map(int, input().split()))
k = 0
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		k += 1
print(k)


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
(n, m, z) = map(int, input().split())
c = n * m // gcd(n, m)
print(z // c)


def gcd(m, n):
	while n:
		(m, n) = (n, m % n)
	return m
(n, m, z) = map(int, input().split())
lcm = n * m // gcd(n, m)
print(z // lcm)


(n, m, z) = map(int, input().split())
(a, b) = ([], [])
(ans, i) = (1, 1)
while n * i <= z or m * i <= z:
	a.append(n * i)
	b.append(m * i)
	i += 1
print(len(set(a) & set(b)))


(n, m, z) = input().split(' ')
(n, m, z) = (int(n), int(m), int(z))
print(len([x for x in range(1, z + 1) if x % n == 0 and x % m == 0]))


def gcd(a, b):
	while b > 0:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b / gcd(a, b)
(n, m, z) = map(int, input().split())
pr1 = lcm(n, m)
p = z // pr1
print('%.f' % p)


import math

def LCM(n, m):
	return n * m // math.gcd(n, m)
(n, m, z) = map(int, input().split(' '))
print(z // LCM(n, m))


str1 = input()
(n, m, z) = str1.split()
n = int(n)
m = int(m)
z = int(z)

def gcd(a, b):
	r = a % b
	while r:
		a = b
		b = r
		r = a % b
	return b

def lcm(a, b):
	return a * b // gcd(a, b)
print(z // lcm(m, n))


(N, M, Z) = map(int, input().split())
_arr_N = []
_arr_M = []
for x1 in range(1, Z // N + 1):
	_arr_N.append(x1 * N)
for x2 in range(Z // M + 1):
	_arr_M.append(x2 * M)
match_result = 0
match_result = len(list(set(_arr_N) & set(_arr_M)))
print(match_result)


(a, b, c) = map(int, input().split())
d = []
e = []
x = y = int(1)
k = int(0)
while x * a <= c:
	d.append(x * a)
	x = x + 1
while y * b <= c:
	e.append(y * b)
	y = y + 1
for z in d:
	if z in e:
		k = k + 1
print(k)


import math
(n, m, z) = map(int, input().split())
aa = math.gcd(n, m)
ax = n * m // aa
print(z // ax)


(n, m, z) = map(int, input().split())

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
gd = gcd(n, m)
lm = n * m // gd
print(z // lm)


(n, m, z) = map(int, input().split())
ans = 0
for i in range(n, z + 1, n):
	if i % m == 0:
		ans += 1
print(ans)


(n, m, z) = map(int, input().split())
b = n
c = m
l = 1
l1 = 1
a = []
j = 0
for i in range(0, z):
	a.append(1)
while n <= z:
	a[n - 1] = 0
	l = l + 1
	n = b * l
while m <= z:
	if a[m - 1] == 0:
		j = j + 1
	l1 = l1 + 1
	m = c * l1
print(j)


def solve(n, m, z):
	x = set(range(n, z + 1, n))
	y = set(range(m, z + 1, m))
	z = list(range(1, z + 1))
	c = 0
	for i in z:
		if i in x and i in y:
			c += 1
	return c

def main():
	(n, m, z) = list(map(int, input().split()))
	print(solve(n, m, z))
main()


__author__ = 'artyom'

def main():
	(n, m, z) = read(3)
	return z // (n * m // gcd(n, m))

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def read(mode=1, size=None):
	if mode == 0:
		return input().strip()
	if mode == 1:
		return int(input().strip())
	if mode == 2:
		return input().strip().split()
	if mode == 3:
		return list(map(int, input().strip().split()))
	a = []
	for _ in range(size):
		a.append(read(3))
	return a

def write(s='\n'):
	if s is None:
		s = ''
	if isinstance(s, tuple) or isinstance(s, list):
		s = ' '.join(map(str, s))
	s = str(s)
	print(s, end='\n')
write(main())


from math import gcd
(a, b, c) = map(int, input().split())
print(int(c / (a * b / gcd(a, b))))


def hcf(a, b):
	while a % b != 0:
		rec = a % b
		a = b
		b = rec
	return b
(n, m, d) = list(map(int, input().split()))
maxi = max(m, n)
mini = min(m, n)
lcm = m * n / hcf(maxi, mini)
print(int(d // lcm))


import math
(n, m, z) = list(map(int, input().split()))
res = z * math.gcd(n, m) / n / m
print(int(res))


(n, m, z) = (int(x) for x in input().split())
print(sum([1 for x in range(1, z + 1) if x % n == x % m == 0]))


def MCM(a, b):
	if b > a:
		aux = b
		b = a
		a = aux
	x = a
	y = b
	while b > 0:
		r = a % b
		a = b
		b = r
	mcm = x // a * y
	return mcm
(A, B, C) = [int(x) for x in input().split()]
MCM = MCM(A, B)
print(C // MCM)


def computerHCF(x, y):
	if x > y:
		smaller = y
	else:
		smaller = x
	hcf = 1
	i = x + 1
	while 1:
		i -= 1
		if x is 1:
			break
		if x % i == 0 and y % i == 0:
			hcf = i
			break
	return hcf
(a, b, n) = [int(x) for x in input().split()]
k = a * b // computerHCF(a, b)
print(n // k)


import os
LOCAL_PC = 'n1amr' in os.path.expanduser('~')

def process_file(in_name, out_name):
	with open(in_name, 'r') as fin:
		with open(out_name, 'w') as fout:

			def read():
				return fin.readline().rstrip('\n')

			def write(*args, end='\n'):
				text = ' '.join(map(str, args)) + end
				fout.write(text)
				print(text, end='')
			t = int(fin.readline())
			for i in range(t):
				read()
				write('Case #{T}: \n'.format(T=i + 1), end='')
				solve(read, write)
				write()

def process_stdio():

	def read():
		return input()

	def write(*args, end='\n'):
		print(*args, end=end)
	solve(read, write)

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def solve(input, print):
	(n, m, z) = map(int, input().split())
	print(z // lcm(n, m))
if LOCAL_PC:
	in_name = __file__[:-3] + '.in'
	out_name = __file__[:-3] + '.out'
	process_file(in_name, out_name)
else:
	process_stdio()


(m, n, z) = map(int, input().split())

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
gc = gcd(m, n)
gc = m * n / gc
temp = gc
co = 0
while temp <= z:
	co += 1
	temp += gc
print(co)


(n, m, z) = map(int, input().split())
cnt = 0
for i in range(1, z + 1):
	b = n * i
	if b <= z:
		if b % m == 0:
			cnt += 1
	else:
		break
print(cnt)


(a, b, c) = map(int, input().split())
cnt = 0
for i in range(1, c + 1):
	if i % a == 0 and i % b == 0:
		cnt += 1
print(cnt)


(n, m, z) = map(int, input().split())

def is_killed(n, m, z):
	return z % n == 0 and z % m == 0
print(len([i for i in range(1, z + 1) if is_killed(n, m, i)]))


def GCD(a, b):
	if a == 0 or b == 0:
		return a + b
	return GCD(b % a, a)
(n, m, z) = map(int, input().split())
dp = n * m // GCD(n, m)
print(z // dp)


(n, m, z) = [int(i) for i in input().split()]
a = []
b = []
i = 1
while i * n <= z:
	a.append(i * n)
	i += 1
i = 1
while i * m <= z:
	b.append(i * m)
	i += 1
a_set = set(a)
b_set = set(b)
print(len(a_set.intersection(b_set)))


import math
(n, m, z) = map(int, input().split())
g = n * m // math.gcd(n, m)
print(z // g)


(n, m, z) = [int(x) for x in input().split()]
a = []
b = []
count = 0
for i in range(1, z + 2):
	if n * i <= z:
		a.append(n * i)
	if m * i <= z:
		b.append(m * i)
i = 0
for i in a:
	if i in b:
		count += 1
print(count)


a = input().split()
n = int(a[0])
m = int(a[1])
z = int(a[2])
import math
q = m * n / math.gcd(m, n)
print(int(z // q))


inp = input().split()
n = int(inp[0])
m = int(inp[1])
z = int(inp[2])
for q in range(1, m + 1):
	if not n * q % m:
		break
lcm = n * q
print(z // (n * q))


import math
(n, m, z) = map(int, input().split())
x = n * m // math.gcd(n, m)
print(z // x)


(n, m, z) = map(int, input().split())
l1 = []
l2 = []
l3 = []
i = 1
while z >= n * i:
	l2.append(n * i)
	i = i + 1
i = 1
while z >= m * i:
	l2.append(m * i)
	i = i + 1
s = set(l2)
print(len(l2) - len(s))


(n, m, z) = map(int, input().split())
t = 0
for i in range(1, z // n + 1):
	for j in range(1, z // m + 1):
		if n * i == m * j:
			t += 1
print(t)


def gcd(a, b):
	if b == 0:
		return a
	if a > b:
		return gcd(b, a % b)
	else:
		return gcd(a, b % a)
(a, b, c) = map(int, input().split())
print(len([i for i in range(a * b // gcd(a, b), c + 1, a * b // gcd(a, b))]))


__author__ = 'Ryabchun Vladimir'
(n, m, z) = map(int, input().split())
time_line = [False for _ in range(z)]
call = n - 1
while call < z:
	time_line[call] = True
	call += n
actor_coming = m - 1
ans = 0
while actor_coming < z:
	if time_line[actor_coming] is True:
		ans += 1
		actor_coming += m
	else:
		actor_coming += m
print(ans)


(n, m, z) = map(int, input().split())
e = set()
d = []
for i in range(n, z + 1, n):
	e.add(i)
for i in range(m, z + 1, m):
	if i in e:
		d.append(i)
print(len(d))


(n, m, z) = [int(item) for item in input().split()]
ans = 0
for i in range(1, z + 1):
	if i % m == 0 and i % n == 0:
		ans += 1
print(ans)


import sys
from sys import stdin, stdout
import bisect
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())
import math

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def main():
	a = ain()
	x = a[0]
	y = a[1]
	if a[1] == a[2] and (not float(a[2] / a[0]).is_integer()):
		print('0')
	elif float(a[1] / a[0]).is_integer():
		print(a[2] // a[1])
	elif GCD(a[0], a[1]) == 1:
		print(a[2] // (a[1] * a[0]))
	else:
		for i in range(1, a[0]):
			if float(a[1] / i).is_integer() and float(a[0] / i).is_integer():
				x = int(x / i)
				y = int(y / i)
			if GCD(x, y) == 1:
				break
		print(a[2] // (x * y * i))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def readnumbers(zero=0):
	conv = ord if py2 else lambda x: x
	A = []
	numb = zero
	sign = 1
	i = 0
	s = sys.stdin.buffer.read()
	try:
		while True:
			if s[i] >= b'0'[0]:
				numb = 10 * numb + conv(s[i]) - 48
			elif s[i] == b'-'[0]:
				sign = -1
			elif s[i] != b'\r'[0]:
				A.append(sign * numb)
				numb = zero
				sign = 1
			i += 1
	except:
		pass
	if s and s[-1] >= b'0'[0]:
		A.append(sign * numb)
	return A
main()


from math import gcd

def lcm(a, b):
	return a * b / gcd(a, b)
(a, b, c) = map(int, input().split())
(a, b) = (min(a, b), max(a, b))
if not b % a:
	print(c // b)
else:
	print(int(c // lcm(a, b)))


def int_lst_input():
	return [int(val) for val in input().split(' ')]

def int_input():
	return int(input())

def print_lst(lst):
	print(' '.join([str(val) for val in lst]))

def solve():
	(n, m, z) = int_lst_input()
	n_min = {n * i for i in range(1, z + 1) if n * i <= z}
	m_min = {m * i for i in range(1, z + 1) if m * i <= z}
	print(len(n_min.intersection(m_min)))
solve()


(a, b, c) = map(int, input().split())
i = 0
j = b
ans = 0
while j <= c:
	while i < j:
		i += a
	if i == j:
		ans += 1
	j += b
print(ans)


(n, m, k) = map(int, input().split())
count = 0
for i in range(1, k + 1):
	if i % n == 0 and i % m == 0:
		count += 1
print(count)


a = list(map(int, input().split()))
sum = 0
if min(a) == 0:
	print(0)
	exit()
for i in range(min(a), a[2] + 1):
	if i % a[0] == 0 and i % a[1] == 0:
		sum += 1
print(sum)


(n, m, z) = [int(x) for x in input().split()]
l1 = []
l2 = []
k = 0
for i in range(1, z + 1):
	n = i * n
	m = m * i
	if n <= z:
		l1.append(n)
	if m <= z:
		l2.append(m)
	n = n // i
	m = m // i
for i in l1:
	if i in l2:
		k += 1
print(k)


List = list(map(int, input().split()))
(n, m, z, total) = (List[0], List[1], List[2], 0)
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		total += 1
print(total)


(a, b, c) = list(map(int, input().split()))
r = 0
q = 0
(a, b) = sorted([a, b])
a1 = a
b1 = b
while a1 != c + 1 or b1 != c + 1:
	q = b1 % a1
	if q == 0:
		r += 1
	b1 += b
	if a1 > c or b1 > c:
		break
if b > c:
	print(0)
else:
	print(r)


[n, m, z] = [int(x) for x in input().split()]

def gcd(a, b):
	return max(a, b) if min(a, b) == 0 else gcd(b, a % b)
print(z // (m * n // gcd(m, n)))


t = input()
(n, m, z) = t.split()
if int(n) == 1:
	ar = int(z) // int(m)
	print(ar)
elif int(n) == int(m):
	print(int(z) // int(n))
else:
	artist = [x for x in range(1, int(z) + 1) if x % int(n) == 0]
	k = 0
	for x in artist:
		if x % int(m) == 0:
			k += 1
	print(k)


s = input().split()
n = int(s[0])
m = int(s[1])
z = int(s[2])
k = 0
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		k += 1
print(k)


(n, m, z) = map(int, input().split())
(a, b) = (max(n, m), min(n, m))
while b:
	(a, b) = (b, a % b)
print(int(z // (n * m / a)))


import math
(n, m, k) = map(int, input().split())
print(k // (n * m // math.gcd(n, m)))


unos = input()
lista = unos.split(' ')
(n, m, z) = (int(lista[0]), int(lista[1]), int(lista[2]))
zbroj = 0
for i in range(n, z + 1, n):
	if i % m == 0:
		zbroj = zbroj + 1
print(zbroj)


line = input().split(sep=' ')
n = int(line[0])
m = int(line[1])
z = int(line[2])
count = 0
for i in range(max(n, m), z + 1):
	if i % n == 0 and i % m == 0:
		count += 1
print(count)


def gcd(a, b):
	if a % b == 0:
		return b
	else:
		return gcd(b, a % b)
(a, b, c) = list(map(int, input().strip().split()))
k = a * b / gcd(a, b)
print(int(c // k))


(a, b, c) = map(int, input().split())

def HCF(a, b):
	d = 3
	if b > a:
		r = a
		x = b
	else:
		r = b
		x = a
	while d != 0:
		d = r % x
		r = x
		x = d
	return r
r = int(a * b / HCF(a, b))
print(int(c / r))


(n, m, z) = map(int, input().split(' '))
a = max(n, m)
b = min(n, m)
A = []
for i in range(z):
	if (i + 1) % a == 0:
		A.append(i + 1)
c = 0
for j in range(len(A)):
	if A[j] % b == 0:
		c = c + 1
print(c)


x = list(map(int, input().split()))
n = x[0]
m = x[1]
z = x[2]
sum = 0
for i in range(1, z + 1):
	if i % n == 0 and i % m == 0:
		sum += 1
print(sum)


(n, m, z) = map(int, input().split())
c = min(n, m)
m = max(n, m)
n = c
ans = 0
for i in range(n, z + 1, n):
	if i % m == 0:
		ans += 1
print(ans)


(n, m, k) = map(int, input().split())
nn = n
mm = m
o = 0
for i in range(1, k + 1):
	if i == nn and i == mm:
		o += 1
	if i == nn:
		nn += n
	if i == mm:
		mm += m
print(o)


[n, m, z] = list(map(int, input().split()))

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	if b == 0:
		return a
	return gcd(b, a % b)
g = gcd(n, m)
x = n * m // g
res = z // x
print(res)


a = set()
b = set()
(n, m, z) = map(int, input().split())
e = 1
while e * m <= z:
	b.add(e * m)
	e += 1
e = 1
while e * n <= z:
	a.add(e * n)
	e += 1
c = a & b
print(len(c))


(ilyushaT, artistsT, timeline) = [int(x) for x in input().split(' ')]
drownArtists = 0
ArtistTime = artistsT
IlyushaTime = ilyushaT
for sec in range(1, timeline + 1):
	if sec == IlyushaTime and sec == ArtistTime:
		drownArtists += 1
	if sec == ArtistTime:
		ArtistTime += artistsT
	if sec == IlyushaTime:
		IlyushaTime += ilyushaT
print(drownArtists)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
[n, m, z] = list(map(int, input().split(' ')))
bcnn = n * m // gcd(n, m)
print(z // bcnn)


import math
(a, b, c) = map(int, input().split())
k = 0
x = a * b // math.gcd(a, b)
print(int(c // x))


from fractions import gcd
from sys import stdin as fin
(n, m, z) = map(int, fin.readline().split())
print(z // (n * m // gcd(n, m)))


(n, m, z) = map(int, input().split())
a = []
count = 0
for i in range(0, z + 1, 1):
	a.append(0)
for i in range(n, z + 1, n):
	a[i] = 1
for i in range(m, z + 1, m):
	if a[i] == 1:
		count += 1
print('%d' % count)


(a, b, c) = map(int, input().split())
i = 1
s = []
t = []
while a * i <= c:
	s.append(a * i)
	i = i + 1
i = 1
while b * i <= c:
	t.append(b * i)
	i = i + 1
print(len(list(set(s) & set(t))))


(a, b, c) = map(int, input().split())
l = []
x = []
for i in range(1, c + 1):
	if a * i > c and b * i > c:
		break
	l.append(a * i)
	x.append(b * i)
l = set(l)
x = set(x)
print(len(l.intersection(x)))


(n, m, z) = map(int, input().split())
calls = set()
arrivals = set()
k = 1
l = 1
while k * n <= z:
	calls.add(k * n)
	k += 1
while l * m <= z:
	arrivals.add(l * m)
	l += 1
print(len(calls.intersection(arrivals)))


import math
(a, b, c) = map(int, input().split())
s = math.gcd(a, b)
z = a * b / s
print(int(c // z))


def lcm(x, y):
	if x > y:
		greater = x
	else:
		greater = y
	while True:
		if greater % x == 0 and greater % y == 0:
			lcm = greater
			break
		greater += 1
	return lcm
(n, m, z) = [int(x) for x in input().strip().split()]
fpb = lcm(n, m)
print(z // fpb)


(n, m, z) = map(int, input().split())
dic1 = {}
dic2 = {}
res = []
cnt = 0
if n == m and m == z:
	print(1)
else:
	for i in range(1, z // n + 1):
		dic1[i] = i * n
	for i in range(1, z // m + 1):
		dic2[i] = i * m
	print(len(set(dic1.values()) & set(dic2.values())))


def bcnn(a, b):
	m = a
	n = b
	while m != n:
		if m > n:
			m -= n
		else:
			n -= m
	return int(a / m) * b
(n, m, z) = [int(x) for x in input().split()]
print(int(z / bcnn(n, m)))


import math

def answer():
	a = [int(x) for x in input().split()]
	print(int(a[2] / (a[0] * a[1] / math.gcd(a[0], a[1]))))
answer()


(n, m, z) = list(map(int, input().split()))
s1 = set()
s2 = set()
i = 1
while True:
	if n * i > z and m * i > z:
		break
	if n * i <= z:
		s1.add(n * i)
	if m * i <= z:
		s2.add(m * i)
	i += 1
s = s1.intersection(s2)
print(len(s))


import math
string = input()
numbers = string.split(' ')
x = int(numbers[0])
y = int(numbers[1])
z = int(numbers[2])
print(z // (x * y // math.gcd(x, y)))


def gcd(n, m):
	if n < m:
		(n, m) = (m, n)
	while n > 0 and m > 0:
		t = n
		n = m
		m = t % n
	return n
(n, m, z) = list(map(int, input().split()))
lca = n * m // gcd(n, m)
print(z // lca)


(n, m, z) = map(int, input().split())
(l1, l2) = ([], [])
for i in range(1, z + 1):
	if n * i > z:
		break
	l1.append(n * i)
for i in range(1, z + 1):
	if m * i > z:
		break
	l2.append(m * i)
L = list(set(l1).intersection(l2))
print(len(L))


(n, m, z) = map(int, input().split())
a = []
b = []
a1 = n
c = 0
i = n
while i <= z:
	a.append(i)
	i += a1
j = m
b1 = m
while j <= z:
	b.append(j)
	j += b1
for k in a:
	if k in b:
		c += 1
print(c)


(n, m, z) = map(int, input().split())
gcd = lambda a, b: a if not b else gcd(b, a % b)
p = gcd(n, m)
l = n * m // p
print(z // l)


(n, k, z) = [int(x) for x in input().split()]
o = 0
for i in range(max(n, k), z + 1):
	if i % n == 0 and i % k == 0:
		o += 1
print(o)


(n, m, z) = list(map(int, input().split()))
p = dict()
kp = 0
pod = n
lod = m
tam = 2
for item in list(range(1, z + 1)):
	p[item] = 0
while n <= z:
	p[n] += 1
	n = tam * pod
	tam += 1
tam = 2
while m <= z:
	if p[m] == 1:
		kp += 1
	else:
		pass
	m = tam * lod
	tam += 1
print(kp)


arr1 = []
arr2 = []
(n, m, z) = map(int, input().split())
for i in range(n, z + 1, n):
	arr1.append(i)
for i in range(m, z + 1, m):
	arr2.append(i)
print(len(set(arr1).intersection(set(arr2))))


def findSame(n, m, z):
	count = 0
	aList = []
	bList = []
	if n is m:
		print(int(z / n))
	else:
		for i in range(1, z + 1):
			if n * i <= z:
				aList.append(n * i)
			else:
				break
		for i in range(1, z + 1):
			if m * i <= z:
				bList.append(m * i)
		print(len(set(bList) & set(aList)))
(n, m, z) = map(int, input().split())
findSame(n, m, z)


(n, m, a) = map(int, input().split())
kill = 0
for i in range(1, a + 1):
	if i % n == 0 and i % m == 0:
		kill += 1
print(kill)


(n, m, z) = list(map(int, input().split()))
minute = 1
acters = 0
while minute <= z:
	if minute % m == 0 and minute % n == 0:
		acters = acters + 1
	minute = minute + 1
print(acters)


__author__ = 'Dilshod'
(n, m, z) = map(int, input().split())
(a, b) = (set(), set())
for i in range(n, z + 1, n):
	a.add(i)
for i in range(m, z + 1, m):
	b.add(i)
print(len(a.intersection(b)))


import sys
arr = list(map(int, input().split()))
n = arr[0]
m = arr[1]
z = arr[2]
cnt = 0
store = [0] * (z + 1)
for i in range(1, z + 1):
	if n * i <= z:
		store[n * i] += 1
	if m * i <= z:
		store[m * i] += 1
print(store.count(2))


(n, m, z) = map(int, input().split())

def eug(a, b):
	while a != 0 and b != 0:
		if a > b:
			a = a % b
		else:
			b = b % a
	return a + b
print(int(z // (m * n / eug(m, n))))


def amrendra():
	c = 0
	(n, m, z) = map(int, input().split())
	for i in range(n, z + 1, n):
		if i % m == 0:
			c += 1
	print(c)
amrendra()


(n, m, z) = map(int, input().split())
c = 0
(li1, li2) = ([], [])
for i in range(n, z + 1, n):
	li1.append(i)
for i in range(m, z + 1, m):
	li2.append(i)
for i in li2:
	if i in li1:
		c += 1
print(c)


(n, m, z) = map(int, input().split())
a = z // n
c = z // m
A = []
C = []
s = 0
for i in range(1, a + 1):
	A += [n * i]
for i in range(1, c + 1):
	C += [m * i]
for i in A:
	if i in C:
		s += 1
print(s)


(u, v, n) = map(int, input().split())
w = 0
for i in range(n):
	if (i + 1) % u == 0 and (i + 1) % v == 0:
		w += 1
print(w)


def codeforces(n, m, z):
	lst_n = set([el * n for el in range(1, z // n + 1)])
	lst_m = set([el * m for el in range(1, z // m + 1)])
	return len(lst_n & lst_m)
(n, m, z) = map(int, input().split())
print(codeforces(n, m, z))


import math
(n, m, z) = str(input()).split()
n = int(n)
m = int(m)
z = int(z)
print(z * math.gcd(n, m) // (n * m))


import fractions

def lcm(a, b):
	return a * b // fractions.gcd(a, b)
(n, m, z) = map(int, input().split())
print(z // lcm(n, m))


(n, m, z) = map(int, input().split())
i = n
c = 0
k = 1
while i <= z:
	if i % m == 0:
		c += 1
	k += 1
	i = k * n
print(c)


def gcd(x, y):
	while y != 0:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
(n, m, z) = map(int, input().split())
print(z // lcm(n, m))


(a, b, n) = map(int, input().split())
x = [i for i in range(a, n + 1, a)]
y = [i for i in range(b, n + 1, b)]
print(len(set(x).intersection(set(y))))


import math
(a, b, c) = [int(i) for i in input().split()]
gdf = a * b // math.gcd(a, b)
ans = 0
for i in range(1, c + 1):
	if i % gdf == 0:
		ans += 1
print(ans)


read = lambda : map(int, input().split())
(n, m, z) = read()
from fractions import gcd
ans = z // (n * m // gcd(n, m))
print(ans)


(n, m, z) = map(int, input().split())
a = n
b = m
while True:
	rem = n % m
	if rem == 0:
		break
	else:
		n = m
		m = rem
hcf = m
lcm = a * b / hcf
print(int(z // lcm))


(n, m, z) = map(int, input().split())
a = [i for i in range(n, z + 1, n)]
b = [j for j in range(m, z + 1, m)]
c = 0
for x in a:
	if x in b:
		c += 1
print(c)


ip = input().split(' ')
ip = list(map(int, ip))
phone = 0
visit = 0
count = 0
while phone < ip[2] and visit < ip[2]:
	phone += 1
	visit += 1
	if phone % ip[0] == 0 and visit % ip[1] == 0:
		count = count + 1
print(count)


(N, M, Z) = map(int, input().split())
ans = 0
for i in range(1, Z + 1):
	if i % N == 0 and i % M == 0:
		ans += 1
print(ans)


def read_input():
	line = input().strip().split()
	(n, m, z) = (int(line[0]), int(line[1]), int(line[2]))
	from math import gcd
	k = n * m // gcd(n, m)
	print(z // k)
read_input()


(x, y, z) = map(int, input().split())
m = [i for i in range(1, z + 1) if i % x == 0 and i % y == 0]
print(len(m))


import math
(n, m, z) = map(int, input().split())
u = m * n // math.gcd(m, n)
print(z // u)


(n, m, z) = map(int, input().split())
nn = []
for i in range(1, z + 1):
	if n * i <= z:
		nn.append(n * i)
	else:
		break
mm = []
for i in range(1, z + 1):
	if m * i <= z:
		mm.append(m * i)
	else:
		break
print(len(set(mm) & set(nn)))


(a, b, c) = map(int, input().split())
(r, t) = ([], [])
i = 1
q = 1
z = 0
while b * i < c + 1:
	t.append(b * i)
	i += 1
while a * q < c + 1:
	r.append(a * q)
	q += 1
for i in r:
	if i in t:
		z += 1
print(z)


def gcd(a, b):
	if a < b:
		return gcd(b, a)
	if b == 0:
		return a
	return gcd(b, a % b)
(a, b, z) = map(int, input().split())
print(z // (a * b // gcd(a, b)))


(a, b, c) = map(int, input().split())
p = a * b
while a != 0 and b != 0:
	(a, b) = (b, a % b)
k = p // a
print(c // k)


g = lambda x, y: g(y, x % y) if y else x
l = lambda x, y: x * y // g(x, y)
(a, b, c) = map(int, input().split())
print(c // l(a, b))


(n, m, z) = map(int, input().split())
p = 0
v = [n * i for i in range(1, z // n + 1)]
q = [m * i for i in range(1, z // m + 1)]
for j in v:
	for k in q:
		if j == k:
			p += 1
print(p)


from math import gcd

def solve(n, m, z):
	lcm = n * m // gcd(n, m)
	return z // lcm

def main():
	(n, m, z) = list(map(int, input().split()))
	print(solve(n, m, z))
main()


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def hcf(a, b):
	return a * b / gcd(a, b)
(n, m, z) = map(int, input().split())
ans = int(z // hcf(n, m))
print(ans)


import math
import string

def lcm(x, y):
	if x > y:
		greater = x
	else:
		greater = y
	while True:
		if greater % x == 0 and greater % y == 0:
			l = greater
			break
		greater += 1
	return l
(m, n, z) = map(int, input().split())
a = lcm(m, n)
c = 0
d = 0
d = d + a
while d <= z:
	d = d + a
	c = c + 1
print(c)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y / gcd(x, y)

def main():
	(a, b, c) = LI()
	return int(c // lcm(a, b))
print(main())


import sys, math
(n, m, z) = [int(x) for x in sys.stdin.readline().split()]
lcm = n * m // math.gcd(n, m)
print(z // lcm)


(n, m, z) = map(int, input().split())
c = 0
for i in range(0, z + 1, n):
	if i == 0:
		pass
	elif not i % m:
		c += 1
print(c)


(n, m, z) = map(int, input().split())
l = [n * (i + 1) for i in range(z // n)]
l2 = [m * (i + 1) for i in range(z // m)]
l += l2
print(len(l) - len(set(l)))


q = list(map(int, input().split()))
a = q[0]
b = q[1]
l = 0
for i in range(q[0], 100000, q[0]):
	if a > q[2]:
		break
	if a % q[1] == 0:
		l += 1
	a += q[0]
print(l)


(n, m, z) = map(int, input().split())
a = 0
b = m
for i in range(z):
	if m % n == 0 and m <= z:
		a += 1
	m += b
print(a)


(n, m, z) = map(int, input().split())
(i, j) = (1, 1)
p = n
q = m
call = []
art = []
while p <= z:
	call.append(p)
	i += 1
	p = i * n
while q <= z:
	art.append(q)
	j += 1
	q = j * m
ans = set(call).intersection(set(art))
print(len(ans))


k = list(map(int, input().split()))
a = k[0]
b = k[1]
n = 0
if a < b:
	(a, b) = (b, a)
while a % b != 0:
	a %= b
	if a < b:
		(a, b) = (b, a)
z = k[0] * k[1] / b
a = k[0]
b = k[1]
if a < b:
	(a, b) = (b, a)
while z <= k[2]:
	if z % a == 0:
		n += 1
	z += b
print(n)


(n, m, z) = map(int, input().split())
calls = [i * n for i in range(1, z // n + 1)]
artists = [j * m for j in range(1, z // m + 1)]
(calls, artists) = (set(calls), set(artists))
print(len(calls.intersection(artists)))


(tamyr, artist, day) = list(map(int, input().split()))
count = 0
for i in range(1, day + 1):
	if i % tamyr == 0 and i % artist == 0:
		count += 1
print(count)


def gcd(a, b):
	if b > a:
		return gcd(b, a)
	if a % b == 0:
		return b
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
(n, m, z) = list(map(int, input().split(' ')))
lcm_m_n = lcm(n, m)
no_of_artists_killed = z // lcm_m_n
print(no_of_artists_killed)


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import math
(n, m, z) = mi()
c = 0
for i in range(n, z + 1, n):
	if i % m == 0:
		c += 1
print(c)


(n, m, z) = map(int, input().split())
v = [0 for i in range(z + 1)]
for i in range(n, z + 1, n):
	v[i] += 1
for i in range(m, z + 1, m):
	v[i] += 1
print(v.count(2))


(n, m, z) = list(map(int, str.split(input())))
print(len(set(range(n, z + 1, n)) & set(range(m, z + 1, m))))


from math import gcd
(n, m, z) = map(int, input().split())
h = gcd(n, m)
f = n * m // h
print(z // f)


def gcd(x, y):
	while True:
		if x == 0:
			break
		if y == 0:
			break
		if x > y:
			x %= y
		else:
			y %= x
	return x + y
lcm = lambda x, y: x * y // gcd(x, y)
(n, m, z) = map(int, input().split())
print(z // lcm(n, m))


import sys
import math
import bisect

def main():
	(a, b, n) = map(int, input().split())
	ans = n // (a * b // math.gcd(a, b))
	print(ans)
main()


def my_gcd(a, b):
	if b == 0:
		return a
	else:
		return my_gcd(b, a % b)

def main():
	mode = 'filee'
	if mode == 'file':
		f = open('test.txt', 'r')
	get = lambda : [int(x) for x in (f.readline() if mode == 'file' else input()).split()]
	[n, m, z] = get()
	lcm = n * m // my_gcd(n, m)
	print(z // lcm)
	if mode == 'file':
		f.close()
main()


a = list(map(int, input().split()))
n = a[0]
m = a[1]
z = a[2]
k = 0
while z != 0:
	if z % m == 0 and z % n == 0:
		k += 1
	z -= 1
print(k)


(n, m, z) = list(map(int, input().strip().split()))
l = []
t = []
for i in range(n, z + 1, n):
	l += [i]
for j in range(m, z + 1, m):
	t += [j]
p = 0
for i in l:
	if i in t:
		p += 1
print(p)


(n, m, z) = map(int, input().split())
x = set()
y = set()
i = 1
while z >= n * i or z >= m * i:
	x.add(n * i)
	y.add(m * i)
	i = i + 1
x.intersection_update(y)
print(len(x))


(n, m, z) = map(int, input().split())
a = list()
b = list()
c = int(0)
for i in range(z):
	a.append(0)
	b.append(0)
	if (i + 1) % n == 0:
		a[i] = 1
	if (i + 1) % m == 0:
		b[i] = 1
	if a[i] == b[i] == 1:
		c += 1
print(c)


from fractions import gcd
(a, b, c) = map(int, input().split())
print(int(c // (a * b / gcd(a, b))))


import sys
import inspect
import re
import math
from pprint import pprint as pp
mod = 998244353
MAX = 10 ** 15

def deb(p):
	for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:
		m = re.search('\\bdeb\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)
		print('%s %d' % (m.group(1), p))

def main():
	(n, m, z) = map(int, input().split())
	a = [0] * z
	for i in range(n - 1, z, n):
		a[i] += 1
	for i in range(m - 1, z, m):
		a[i] += 1
	ans = 0
	for i in range(0, z):
		if a[i] == 2:
			ans += 1
	print(ans)
main()


(m, n, z) = input().split()
(m, n, z) = (int(m), int(n), int(z))
count = 0
for i in range(z // m):
	if m * (i + 1) % n == 0:
		count += 1
print(count)


from fractions import gcd

def nok(a, b):
	return a * b / gcd(a, b)
(A, B, Z) = map(int, input().split())
Const = nok(A, B)
i = 0
l = 1
while Const * l <= Z:
	i += 1
	l += 1
print(i)


import math
(a, b, c) = map(int, input().strip().split())
d = a * b
e = d // math.gcd(a, b)
print(c // e)


(n, m, z) = map(int, input().split())
n1 = []
m1 = []
for i in range(1, z + 1):
	if i * n <= z:
		n1.append(i * n)
for j in range(1, z + 1):
	if j * m <= z:
		m1.append(j * m)
n1 = set(n1)
m1 = set(m1)
print(len(n1.intersection(m1)))


def solve(n, m, z):
	r = 0
	for i in range(1, z + 1):
		if i % n == 0 and i % m == 0:
			r += 1
	return r
(n, m, z) = map(int, input().split())
print(solve(n, m, z))


(n, m, z) = map(int, input().split())
x = set()
t = set()
y = 0
c = 0
for i in range(z):
	y = y + n
	if y <= z:
		x = x | {y}
for j in range(z):
	c = c + m
	if c <= z:
		t = t | {c}
r = x & t
print(len(r))


import math
(n, m, z) = map(int, input().split())
t = n * m / math.gcd(n, m)
print(int(z / t))


(n, m, z) = map(int, input().split())
a = set([int(i) * n for i in range(1, z + 1) if int(i) * n <= z])
b = set([int(i) * m for i in range(1, z + 1) if int(i) * m <= z])
print(len(a & b))


(n, m, k) = map(int, input().split())
counter = 0
for i in range(min(n, m), k + 1):
	if i % n == 0 and i % m == 0:
		counter += 1
print(counter)


def calls():
	(n, m, z) = map(int, input().split())
	artists = 0
	kills = 0
	for i in range(1, z + 1):
		if i % m == 0:
			artists += 1
		if i % n == 0:
			kills += artists
			artists = 0
		if artists > 0:
			artists -= 1
	print(kills)
calls()


import sys, queue
try:
	import dev_act_ffc429465ab634
	DEV = True
except:
	DEV = False

def log(*s):
	if DEV:
		print('LOG', *s)

class EJudge:

	def __init__(self, problem='default', reclim=1 << 30):
		self.problem = problem
		sys.setrecursionlimit(reclim)

	def use_files(self, infile='', outfile=''):
		if infile != '':
			self.infile = open(infile)
			sys.stdin = self.infile
		if infile != '':
			self.outfile = open(outfile, 'w')
			sys.stdout = self.outfile

	def use_bacs_files(self):
		self.use_files(self.problem + '.in', self.problem + '.out')

	def get_tl(self):
		while True:
			pass

	def get_ml(self):
		tmp = [[[5] * 100000 for _ in range(1000)]]
		while True:
			tmp.append([[5] * 100000 for _ in range(1000)])

	def get_re(self):
		s = (0,)[8]

	def get_wa(self, wstr='blablalblah'):
		for _ in range(3):
			print(wstr)
		exit()

class IntReader:

	def __init__(self):
		self.ost = queue.Queue()

	def get(self):
		return int(self.sget())

	def sget(self):
		if self.ost.empty():
			for el in input().split():
				self.ost.put(el)
		return self.ost.get()

	def release(self):
		res = []
		while not self.ost.empty():
			res.append(self.ost.get())
		return res

def tokenized(s):
	word = []
	for ch in s.strip():
		if ch == ' ':
			if word:
				yield ''.join(word)
				word = []
		elif 'a' <= ch <= 'z' or 'A' <= ch <= 'Z' or '0' <= ch <= '9':
			word.append(ch)
		else:
			if word:
				yield ''.join(word)
				word = []
			yield ch
	if word:
		yield ''.join(word)
		word = []
ej = EJudge()
int_reader = IntReader()
fmap = lambda f, *l: list(map(f, *l))
parse_int = lambda : fmap(int, input().split())
(n, m, z) = parse_int()
ans = 0
for day in range(1, z + 1):
	if day % n == 0 and day % m == 0:
		ans += 1
print(ans)


import math

def lcm(a, b):
	return a * b // math.gcd(a, b)
(a, b, c) = map(int, input().split())
(i, k) = (1, 0)
while i <= c:
	if i % lcm(a, b) == 0:
		k += 1
	i += 1
print(k)


import math
(n, m, z) = [int(i) for i in input().split()]
l = n * m // math.gcd(n, m)
print(z // l)


import sys
from math import sqrt, floor, factorial
from collections import deque, Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def gcd(a, b):
	mini = min(a, b)
	maxi = max(a, b)
	while maxi % mini != 0:
		(maxi, mini) = (mini, maxi % mini)
	return mini

def solve():
	(n, m, z) = read()
	gcd_ = gcd(n, m)
	print(z // (n * m * gcd_ // gcd_ ** 2))
solve()


def r():
	return list(map(int, input().split()))
(n, m, z) = r()
l = [False for i in range(z + 1)]
t = n
while t <= z:
	l[t] = True
	t += n
t = m
ans = 0
while t <= z:
	if l[t]:
		ans += 1
	t += m
print(ans)


(n, m, z) = map(int, input().split())
nl = []
ml = []
for i in range(1, 10009):
	(x, y) = (n * i, m * i)
	if x <= z or y <= z:
		nl.append(x)
		ml.append(y)
	else:
		break
z = set(ml).intersection(set(nl))
print(len(z))


def int_lst_input():
	return [int(val) for val in input().split(' ')]

def int_input():
	return int(input())

def print_lst(lst):
	print(' '.join([str(val) for val in lst]))

def solve():
	(n, m, z) = int_lst_input()
	(n_min, m_min) = (set(), set())
	i = 1
	while n * i <= z:
		n_min.add(n * i)
		i += 1
	i = 1
	while m * i <= z:
		m_min.add(m * i)
		i += 1
	print(len(n_min.intersection(m_min)))
solve()


from sys import stdin, stdout

def gcd(a, b):
	if not b:
		return a
	else:
		return gcd(b, a % b)
(a, b, time) = map(int, stdin.readline().split())
stdout.write(str(time // (a * b // gcd(a, b))))


(n, m, z) = map(int, input().split(' '))
i = 1
ilia = a = c = 0
while i <= z:
	a = i * n
	if a % m == 0 and a <= z:
		c += 1
	i += 1
print(c)


(a, b, c) = map(int, input().split())
ar = []
i = 1
count = 0
while i * b <= c:
	ar.append(i * b)
	i += 1
j = 1
while j * a <= c:
	if a * j in ar:
		count += 1
	j += 1
print(count)


(n, m, z) = map(int, input().split())
c = n
ans = 0
while c <= z:
	if c % m == 0:
		ans += 1
	c += n
print(ans)


import sys, math, string
input = sys.stdin.readline
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
(n, m, z) = M()
g = math.gcd(n, m)
print(z * g // (n * m))


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
(a, b, c) = map(int, input().split())
print(c // (a * b // gcd(a, b)))


def gcd(x, y):
	if y == 0:
		return x
	else:
		return gcd(y, x % y)

def ppcm(x, y):
	return x * y // gcd(x, y)
(n, m, z) = map(int, input().split())
c = ppcm(n, m)
x = c
kill = 0
while x <= z:
	kill += 1
	x += c
print(kill)


import math
(x, y, z) = map(int, input().split())
print(z // (x * y // math.gcd(x, y)))


(n, m, z) = map(int, input().split())

def gcd(x, y):
	(x, y) = (max(x, y), min(x, y))
	if x % y == 0:
		return y
	else:
		return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)
print(z // lcm(n, m))


(n, m, z) = map(int, input().split())
ns = [i * n for i in range(1, z // n + 1)]
ms = [i * m for i in range(1, z // m + 1)]
cnt = 0
for i in ms:
	for j in ns:
		if j == i:
			cnt = cnt + 1
		if j > i:
			break
print(cnt)


(n, m, z) = list(map(int, input().split()))
l = []
k = []
for i in range(n, z + 1, n):
	l.append(i)
for j in range(m, z + 1, m):
	k.append(j)
s = list(set(l) & set(k))
print(len(s))


(n, m, z) = map(int, input().split())
ll = {i * n for i in range(1, z // n + 1)}
pp = {i * m for i in range(1, z // m + 1)}
k = ll - pp
print(len(ll) - len(k))


def Main():
	kills = 0
	line = input()
	words = line.split()
	n = int(words[0])
	m = int(words[1])
	days = int(words[2])
	for day in range(1, days + 1):
		if day % n == 0 and day % m == 0:
			kills = kills + 1
	print(kills)
Main()


(n, m, z) = input().split()
(n, m, z) = (int(n), int(m), int(z))
a = n
b = m
if n == m:
	print(int(z / n))
elif n < m:
	count = 0
	count = int(count)
	while n <= z:
		n += a
		if n <= z:
			if n % m == 0:
				count += 1
	print(count)
else:
	count = 0
	while m <= z:
		m += b
		if m <= z:
			if m % n == 0:
				count += 1
	print(count)


input_param = input()
(n, m, z) = input_param.split()
n = int(n)
m = int(m)
z = int(z)

def get_lcm(n, m):
	if n > m:
		greater_number = n
	else:
		greater_number = m
	while True:
		if greater_number % n == 0 and greater_number % m == 0:
			lcm = greater_number
			break
		greater_number += 1
	return lcm
print(z // get_lcm(n, m))


(n, m, z) = [int(x) for x in input().split()]
print(len(set(range(n, z + 1, n)) & set(range(m, z + 1, m))))


from math import gcd

def I():
	return map(int, input().split())
(n, m, z) = I()
print(z // (n * m // gcd(n, m)))


from math import *

def lcm(a, b):
	return a * b // gcd(a, b)
(n, m, z) = map(int, input().split())
print(z // lcm(n, m))


(n, m, z) = map(int, input().split())
s1 = set()
s2 = set()
for i in range(1, z + 1):
	if i % n == 0:
		s1.add(i)
	if i % m == 0:
		s2.add(i)
s3 = s1.intersection(s2)
print(len(s3))


import math
(a, b, c) = map(int, input().split())
z = a * b // math.gcd(a, b)
i = 1
while z * i <= c:
	i += 1
print(i - 1)


line = input()
(call_freq, art_freq, day_length) = line.split()
(call_freq, art_freq, day_length) = (int(call_freq), int(art_freq), int(day_length))
final_count = 0
for i in range(int(day_length / art_freq)):
	time = i + 1
	if time * art_freq % call_freq == 0:
		final_count = final_count + 1
print(final_count)


import sys
from math import gcd

def debug(x, table):
	for (name, val) in table.items():
		if x is val:
			print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
			return None

def solve():
	(n, m, z) = map(int, input().split())
	lcm = n * m // gcd(n, m)
	ans = z // lcm
	print(ans)
	pass
solve()


(n, m, z) = map(int, input().split())
count = 0
loop = m
while loop <= z:
	if loop % n == 0:
		count += 1
	loop += m
print(count)


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcd(a, b):
	return a * b // gcd(a, b)
l = list(map(int, input().split()))
print(l[2] // lcd(l[0], l[1]))


(n, m, z) = [int(i) for i in input().split()]
mas = [0 for i in range(z)]
coun = 0
for i in range(n - 1, z, n):
	mas[i] += 1
for j in range(m - 1, z, m):
	mas[j] += 1
print(mas.count(2))


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)

def main():
	(n, m, t) = [int(i) for i in input().split()]
	print(t // lcm(n, m))
main()


(a, b, c) = map(int, input().split())
n = [i for i in range(a, c + 1, a)]
s = [j for j in range(b, c + 1, b)]
count = 0
for x in n:
	if x in s:
		count += 1
print(count)


(n, m, z) = map(int, input().split())
seen = set()
for i in range(1, z // n + 1):
	seen.add(i * n)
ans = 0
for i in range(1, z + 1):
	if m * i in seen:
		ans += 1
print(ans)


a = input().split()
s = 0
for i in range(1, int(a[2]) + 1):
	if i % int(a[0]) == 0 and i % int(a[1]) == 0:
		s += 1
print(s)


import math
(n, m, t) = map(int, input().split())
count = 0
m1 = math.floor(t / m)
(x, y) = ([], [])
for i in range(1, t + 1):
	n1 = n * i
	m1 = m * i
	if n1 <= t:
		x.append(n1)
	if m1 <= t:
		y.append(m1)
print(len(set(x) & set(y)))


def lcm(x, y):
	if x > y:
		greater = x
	else:
		greater = y
	while greater % x != 0 or greater % y != 0:
		greater = greater + 1
	return greater
inp = list()
inp = input()
inp = inp.split(' ')
n = int(inp[0])
m = int(inp[1])
z = int(inp[2])
lcmm = lcm(n, m)
answer = int(z / lcmm)
print(answer)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7

def LI():
	return list(map(int, input().split()))

def II():
	return int(input())

def LS():
	return input().split()

def S():
	return input()

def main():
	(n, m, k) = LI()
	g = math.gcd(n, m)
	t = n * m // g
	return k // t
print(main())


import sys
from fractions import gcd
(n, m, k) = map(int, input().split())
g = gcd(n, m)
lcm = n * m // g
print(k // lcm)


(n, k, b) = list(map(int, input().split()))
s1 = []
ans = 0
for i in range(n, b + 1, n):
	s1.append(i)
for i in range(k, b + 1, k):
	if i in s1:
		ans += 1
print(ans)


(n, m, z) = map(int, input().split())
print(len(set(range(n, z + 1, n)).intersection(set(range(m, z + 1, m)))))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)
(a, b, c) = map(int, input().split())
print(c // lcm(a, b))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return abs(a // gcd(a, b) * b)

def solve():
	(a, b, n) = sep()
	print(n // lcm(a, b))
solve()


(call, performance, day) = (int(x) for x in input().split())
i = 1
calls_per_day = set()
performances_per_day = set()
while i * call <= day:
	calls_per_day.add(i * call)
	i += 1
i = 1
while i * performance <= day:
	performances_per_day.add(i * performance)
	i += 1
ans = calls_per_day & performances_per_day
print(len(ans))


(n, m, z) = list(map(int, input().split()))
call = [n * i for i in range(1, 10001) if n * i <= z]
come = [m * i for i in range(1, 10001) if m * i <= z]
kill = list(set(call) & set(come))
print(len(kill))


abc = input().split()
a = int(abc[0])
b = int(abc[1])
c = int(abc[2])
d = c // a
e = c // b
test = []
test2 = []
count = 0
for i in range(1, d + 1):
	test.append(i * a)
for i in range(1, e + 1):
	if i * b in test:
		count = count + 1
print(count)


(n, m, z) = map(int, input().split())
ni = []
mi = []
count = 0
for i in range(1, z + 1):
	if n * i <= z:
		ni.append(n * i)
	if m * i <= z:
		mi.append(m * i)
for i in ni:
	if i in mi:
		count = count + 1
print(count)


def lcm(x, y):
	if x > y:
		greater = x
	else:
		greater = y
	while True:
		if greater % x == 0 and greater % y == 0:
			lcm = greater
			break
		greater += 1
	return lcm
lst = input().split(' ')
gb = lcm(int(lst[1]), int(lst[0]))
ase = int(int(lst[2]) / gb)
print(ase)


def gcd(a, b):
	while b:
		a %= b
		(a, b) = (b, a)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)

def main():
	(n, m, z) = map(int, input().split())
	q = lcm(n, m)
	print(z // q)
main()


(n, m, z) = map(int, input().split())
n_arr = [i * n for i in range(1, z + 1) if i * n <= z]
m_arr = [i * m for i in range(1, z + 1) if i * m <= z]
count = 0
for i in n_arr:
	if i in m_arr:
		count += 1
print(count)


def gcd(a, b):
	if a < b:
		return gcd(b, a)
	if b == 0:
		return a
	return gcd(b, a % b)
(a, b, n) = [int(x) for x in input().strip().split()]
print(n // (a * b // gcd(a, b)))


(a, b, z) = map(int, input().split())
c = 0
e = max(a, b)
for i in range(e, z + 1, e):
	if i % a == 0 and i % b == 0:
		c += 1
print(c)


def main():
	(n, m, z) = map(int, input().split())
	count = 0
	for i in range(1, z + 1):
		if i % n == 0 and i % m == 0:
			count += 1
	print(count)
main()


import sys

def nod(a, b):
	if b == 0:
		return a
	return nod(b, a % b)

def nok(a, b):
	return int(a * b / nod(a, b))
(n, m, z) = map(int, sys.stdin.readline().split())
print(z // nok(m, n))


(n, m, z) = map(int, input().split())
count = 0
b = max(n, m)
i = b
while i <= z:
	if i % n == 0:
		if i % m == 0:
			count += 1
	i = i + b
print(count)


def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
b = input()
b = b.split(' ')
n = int(b[0])
m = int(b[1])
z = int(b[2])
print(z // lcm(n, m))


def taymir(n, m, z):
	count = 0
	for i in range(1, z + 1):
		if i % n == 0 and i % m == 0:
			count += 1
	return count
(N, M, Z) = [int(j) for j in input().split()]
print(taymir(N, M, Z))


import math
(a, b, c) = map(int, input().split())
aux = a
aux1 = b
paso = 0
for i in range(c):
	d = math.gcd(aux, aux1)
	d = aux * aux1 / d
	if d == 1:
		print(c)
		break
	elif d <= c:
		paso = paso + 1
		aux = aux + a
		aux1 = aux1 + b
	else:
		print(paso)
		break


(x, y, z) = map(int, input().split())
a = list((m for m in range(x, z + 1) if m % x == 0))
b = list((m for m in range(y, z + 1) if m % y == 0))
c = 0
for p in a:
	if p in b:
		c += 1
print(c)


(n, m, z) = map(int, input().split())
if n == m:
	print(z // n)
else:
	kol = 0
	for i in range(1, z + 1):
		if not i % n and (not i % m):
			kol += 1
	print(kol)


import math
(k, n, w) = map(int, input().split())
x = k * n // math.gcd(k, n)
print(w // x)


(n, m, z) = map(int, input().split())
i = 1
while True:
	if i % n == 0 and i % m == 0:
		lcm = i
		break
	i += 1
print(z // lcm)


(n, m, z) = map(int, input().split())
z1 = 1
c = 0
if n == m:
	print(z // n)
else:
	while z1 <= z:
		if z1 % n == 0 and z1 % m == 0:
			c += 1
		z1 += 1
	print(c)


(n, m, z) = [int(i) for i in input().split()]
l = []
nn = n
while n <= z:
	if n % m == 0:
		l.append(n)
	n += nn
print(len(l))


from math import gcd
(a, b, c) = map(int, input().split())
gc = gcd(a, b)
lcm = a * b // gc
x = c // lcm
print(x)


def mmc(n, m):

	def gcd(n, m):
		if m == 0:
			return n
		return gcd(m, n % m)
	return m * n / gcd(m, n)
import sys
(n, m, z) = map(int, input().split())
print(int(z / mmc(n, m)))


(n, m, z) = [int(i) for i in input().split()]
from math import gcd
g = gcd(n, m)
g = n * m // g
print(z // g)


n = list(map(int, input().split()))
k = 0
for i in range(1, n[2] + 1):
	if i % n[0] == 0 and i % n[1] == 0:
		k = k + 1
print(k)


def lcm(a, b):
	m = a * b
	while a != 0 and b != 0:
		if a > b:
			a %= b
		else:
			b %= a
	return m // (a + b)
input1 = list(map(int, input().split()))
n = input1[0]
m = input1[1]
z = input1[2]
f = lcm(n, m)
t = lcm(n, m)
i = 1
utopit = 0
while t <= z:
	utopit += 1
	t = f * i
	i += 1
if utopit == 0:
	print(utopit)
else:
	print(utopit - 1)


import math
nmz = [int(i) for i in input().split()]
n = nmz[0]
m = nmz[1]
z = nmz[2]
h = math.gcd(n, m)
l = int(n * m / h)
ans = int(z // l)
print(ans)


(n, m, z) = map(int, input().split())
numCall = z // n
liaCall = []
for i in range(numCall):
	liaCall.append((i + 1) * n)
numArt = z // m
artTalk = []
for i in range(numArt):
	artTalk.append((i + 1) * m)
killed = 0
for i in range(len(artTalk)):
	if artTalk[i] in liaCall:
		killed += 1
print(killed)


(n, m, z) = (int(i) for i in input().split())
calls = set((i for i in range(0, z + 1, n)))
art = set((i for i in range(0, z + 1, m)))
print(len(calls & art) - 1)


(n, m, z) = map(int, input().split())
b = []
k = n
co = 0
while k <= z:
	b.append(k)
	k = k + n
k = m
while k <= z:
	if k in b:
		co = co + 1
	k = k + m
print(co)


def main():
	(n, m, z) = list(map(int, input().split()))
	set1 = set([i * n for i in range(1, z // n + 1)])
	set2 = set([i * m for i in range(1, z // m + 1)])
	print(len(set.intersection(set1, set2)))
main()


(n, m, z) = map(int, input().split())
x = n
exclude_count = 0
while x <= z:
	if x % m == 0:
		exclude_count += 1
	x += n
print(exclude_count)


import math
(a, b, c) = map(int, input().split())
lcm = a * b / math.gcd(a, b)
ans = int(c / lcm)
print(ans)


from math import *
import sys, random

def nextInt():
	return int(input())

def nextStrs():
	return input().split()

def nextInts():
	return list(map(int, nextStrs()))

def main():
	(a, b, z) = nextInts()
	freq = [0] * (z + 1)
	for i in range(a, z + 1, a):
		freq[i] += 1
	res = 0
	for i in range(b, z + 1, b):
		res += freq[i]
	print(res)
exit(main())


def nsd(x, y):
	if x == 0:
		return y
	else:
		return nsd(y % x, x)
(n, m, z) = map(int, input().split())
print(z // (n * m // nsd(n, m)))


nums = input().split()
n = int(nums[0])
m = int(nums[1])
z = int(nums[2])
ans = 0

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
ans = z / lcm(n, m)
print(int(ans))


import bisect
from collections import defaultdict
from collections import deque
import math
import re

def raw_input():
	return input()

def ni():
	return int(raw_input())

def nis():
	return map(int, raw_input().split())

def si():
	return raw_input()

def sis():
	return raw_input().split()

def spaced(a):
	return ' '.join(map(str, a))

def lcm(a, b):
	c = int(math.gcd(a, b))
	x = a // c
	y = b // c
	return c * x * y
(n, m, z) = nis()
print(z // lcm(n, m))


import math
from fractions import Fraction as frac

def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def solve(case_no):
	(a, b, c) = map(int, input().split())
	print(c // lcm(a, b))
t = 1
for i in range(1, t + 1):
	solve(i)


entrada = input().split()
n = int(entrada[0])
m = int(entrada[1])
z = int(entrada[2])
fila = [0] * (z + 1)
morreu = 0
counter = n
while counter <= z:
	fila[counter] = 1
	counter += n
counter = m
while counter <= z:
	if fila[counter] == 1:
		morreu += 1
	else:
		fila[counter] = 2
	counter += m
print(morreu)


(n, m, z) = map(int, input().split())
gcd = lambda a, b: gcd(b, a % b) if b else a
mm = n * m // gcd(n, m)
print(z // mm)


def euclide(a, b):
	if b == 0:
		return a
	else:
		return euclide(b, a % b)

def ppcm(a, b):
	return b * (a // euclide(a, b))

def f(n, m, z):
	return z // ppcm(n, m)
(n, m, z) = tuple(map(int, input().split()))
print(f(n, m, z))


import math

def solve():
	(n, m, z) = map(int, input().split())
	print(z * math.gcd(n, m) // (n * m))

def main():
	t = 1
	for _ in range(t):
		solve()
main()


(n, m, z) = input().split()
(n, m, z) = (int(n), int(m), int(z))
res = 0
aux = m
while aux <= z:
	if aux % n == 0:
		res += 1
	aux += m
print(res)


(n, m, z) = map(int, input().split())
a = max(n, m)
b = min(n, m)
n = a
m = b
count = 0
while a <= z:
	if a % b == 0:
		count += 1
		a += n
	else:
		a += n
print(count)


(n, m, z) = map(int, input().split())
a = set(range(n, z + 1, n))
b = set(range(m, z + 1, m))
print(len(a & b))


(n, m, z) = map(int, input().split())
i = 1
if m == 0:
	print(0)
elif n == m:
	print(z // n)
else:
	while i <= z:
		if i % m == i % n and i % m == 0:
			print(z // i)
			break
		i += 1
	if i > z:
		print(0)


(n, m, k) = map(int, input().split())
s = 0
for i in range(1, int(k // n) + 1):
	if i * n % m == 0:
		s += 1
print(s)


(n, m, z) = [int(x) for x in input().split()]
s1 = set(range(n, z + 1, n))
s2 = set(range(m, z + 1, m))
k = s1.intersection(s2)
print(len(k))


s = input()
nums = s.split(' ')
t = int(nums[0])
a = int(nums[1])
mday = int(nums[2])
nextlink = t
skip = 0
while nextlink <= mday:
	if nextlink % a == 0:
		skip += 1
	nextlink += t
print(skip)


try:
	(a, b, c) = map(int, input().split())
	count = 0
	for i in range(1, c + 1):
		if i % a == 0 and i % b == 0:
			count = count + 1
	print(count)
except:
	pass


from math import *
from collections import *

def inp():
	return map(int, input().split())

def inp_arr():
	return list(map(int, input().split()))
(n, m, k) = inp()
print(int(k // (n * m / gcd(n, m))))


(a, b, c) = map(int, input().split(' '))
if a == 1 or b == 1:
	print(min(c // a, c // b))
else:
	l = [k for k in range(1, c + 1) if k % a == 0 and k % b == 0]
	print(len(l))


nmz = input()
nmz = nmz.split()
n = int(nmz[0])
m = int(nmz[1])
z = int(nmz[2])
nl = []
ml = []
for i in range(1, z // n + 1):
	nl.append(n * i)
for i in range(1, z // m + 1):
	ml.append(m * i)
c = 0
for i in nl:
	if i in ml:
		c = c + 1
print(c)


from math import gcd

def main():
	(n, m, z) = map(int, input().split())
	print(z * gcd(n, m) // (n * m))
main()


import math

def ria():
	return [int(i) for i in input().split()]
(n, m, z) = ria()
print(z // (n * m // math.gcd(n, m)))


import math
(call, performance, day) = map(int, input().split())
lcm = call * performance // math.gcd(call, performance)
print(day // lcm)


ch = input('')
(n, m, z) = (int(ch.split(' ')[0]), int(ch.split(' ')[1]), int(ch.split(' ')[2]))
if m > n:
	a = m
	b = n
else:
	a = n
	b = m
while b != 0:
	(a, b) = (b, a % b)
pgcd = a
kill = 0
k = m * n // pgcd
for i in range(1, z + 1, 1):
	if i % k == 0:
		kill += 1
print(kill)


from math import gcd

def com(x, y, l, r):
	lcm = x * y // gcd(x, y)
	count1 = (l - 1) // lcm
	countr = r // lcm
	return countr - count1
(n, m, z) = [int(x) for x in input().split(' ')]
print(com(n, m, 1, z))


(a, b, c) = list(map(int, input().split()))
r = 0
b1 = b
while b1 <= c:
	if b1 % a == 0:
		r += 1
	b1 += b
print(r)


nmz = list(map(int, input().split()))
counter = 0
for i in range(min(nmz[0], nmz[1]), nmz[2] + 1):
	if i % nmz[0] == 0 and i % nmz[1] == 0:
		counter += 1
print(counter)


from sys import stdin, stdout
(n, m, z) = map(int, stdin.readline().rstrip().split())
a = n
shoot = 0
while a <= z:
	if a % m == 0:
		shoot += 1
	a += n
print(shoot)


(n, m, z) = map(int, input().split())
pl = [0 for i in range(z + 1)]
i = j = 0
for i in range(1, len(pl)):
	if i % n == 0:
		pl[i] += 1
	if i % m == 0:
		pl[i] += 1
print(pl.count(2))


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
(n, m, z) = map(int, input().split())
a = [0] * (z + 1)
x = n
while x <= z:
	a[x] = 1
	x += n
y = m
while y <= z:
	a[y] += 1
	y += m
print(len([x for x in a if x == 2]))


def gcd(a, b):
	if not a:
		return b
	return gcd(b % a, a)
(n, m, z) = map(int, input().split())
print(z // (n * m // gcd(n, m)))


import functools, sys
input = lambda : sys.stdin.readline()

@functools.lru_cache(maxsize=10000)
def Main():
	(n, m, z) = map(int, input().split())
	mn = 0
	for i in range(1, z + 1):
		if i % n == 0 and i % m == 0:
			mn += 1
	print(mn)
Main()


import math, sys, itertools

def main():
	(n, m, z) = map(int, input().split())
	a = set()
	for i in range(n, z + 1, n):
		a.add(i)
	s = 0
	for i in range(m, z + 1, m):
		if i in a:
			s += 1
	print(s)
main()


(n, m, z) = map(int, input().split())
res = 0
for i in range(1, z + 1):
	res += 1 if i % m + i % n == 0 else 0
print(res)


def lcm(a, b):
	if a < b:
		c = b
		while 1:
			if c % a == 0 and c % b == 0:
				return c
			c += 1
	else:
		c = a
		while 1:
			if c % a == 0 and c % b == 0:
				return c
			c += 1
x = input()
a = x.split(' ')
print(int(int(a[2]) / lcm(int(a[0]), int(a[1]))))


(n, m, z) = [int(i) for i in input().split()]
(a, b) = (n, m)
while n != 0 and m != 0:
	if n > m:
		n %= m
	else:
		m %= n
if n == 0:
	d = m
else:
	d = n
print(z // (a * b // d))


from math import gcd
(Calls_Mins, artst_Mins, MinsInDay) = [int(x) for x in input().split()]
(Intrscts, atMinute, iteR_) = (0, 0, 1)
if gcd(Calls_Mins, artst_Mins) != 1:
	Calls_Mins = Calls_Mins // gcd(Calls_Mins, artst_Mins)
while True:
	atMinute = Calls_Mins * iteR_ * artst_Mins
	if atMinute > MinsInDay:
		break
	iteR_ += 1
	Intrscts += 1
print(Intrscts)


def gcd(fuck, chuda):
	if chuda == 0:
		return fuck
	else:
		return gcd(chuda, fuck % chuda)
(magi, khanki, chutmarani) = map(int, input().split())
sex = gcd(magi, khanki)
luccha = magi * khanki / sex
boobs = chutmarani / luccha
print(int(boobs))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
a = input().split()
x = int(a[0])
y = int(a[1])
n = int(a[2])
if x < y:
	(x, y) = (y, x)
print(int(n // (x * (y / gcd(x, y)))))


from fractions import gcd
(n, m, z) = [int(i) for i in input().split()]
c = int(n / gcd(n, m) * m)
print(z // c)


def GCD(x, y):
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def LCM(x, y):
	return int(x * y / GCD(x, y))
(n, m, z) = tuple([int(x) for x in input().split()])
print(z // LCM(n, m))


(n, m, k) = [int(i) for i in input().split()]

def bmm(n, m):
	if m > n:
		k = m
		m = n
		n = k
	if m == 0:
		return n
	if n % m == 0:
		return m
	return bmm(m, n % m)
print(k // (n * m // bmm(n, m)))


import math
(n, m, z) = map(int, input().strip().split())
GCD = math.gcd(n, m)
LCM = int(n * m / GCD)
ans = int(z / LCM)
print(ans)


(n, m, z) = map(int, input().split(' '))
no_of_artists = int(z / m)
killed = 0
for i in range(no_of_artists):
	if (m + m * i) % n == 0:
		killed += 1
print(killed)


(n, m, z) = list(map(int, input().split()))
calls = set()
perfs = set()
i = 1
while i * n <= z or i * m <= z:
	calls.add(i * n)
	perfs.add(i * m)
	i += 1
print(len(calls & perfs))


from fractions import gcd

def lcm(n, m):
	return n * m // gcd(n, m)
(a, b, c) = map(int, input().split())
print(c // lcm(a, b))


(n, m, z) = tuple(map(int, input().split()))
if z % n != 0:
	z = z // n * n
count = 0
mult = 1
while mult * n <= z:
	if mult * n % m == 0:
		count += 1
	mult += 1
print(count)


z = list(map(int, input().split()))
a = z[0]
b = z[1]
c = z[2]
lt1 = []
lt2 = []
kil = 0
for i in range(1, c + 1):
	if i % a == 0:
		lt1.append(1)
	else:
		lt1.append(0)
	if i % b == 0:
		lt2.append(1)
	else:
		lt2.append(0)
	if lt1[i - 1] + lt2[i - 1] == 2:
		kil += 1
print(kil)


(x, y, z) = map(int, input().split())
l = []
for i in range(1, z + 1):
	if i % y == 0:
		l.append(i)
cnt = 0
for i in l:
	if i % x == 0:
		cnt += 1
print(cnt)


(a, b, c) = list(map(int, input().split()))
count = 0
l = []
k = []
for i in range(1, c + 1):
	if i * a <= c:
		l.append(i * a)
	if i * b <= c:
		k.append(i * b)
for j in l:
	if j in k:
		count += 1
print(count)


(n, m, z) = map(int, input().split())
k = n * m
while m:
	(n, m) = (m, n % m)
print(z * n // k)


def lcm1(x, y):
	if x > y:
		greater = x
	else:
		greater = y
	while True:
		if greater % x == 0 and greater % y == 0:
			lcm = greater
			break
		greater += 1
	return lcm
(n, m, k) = map(int, input().split())
call = lcm1(n, m)
print(k // call)


(call, performance, day) = (int(x) for x in input().split())
calls_per_day = set(range(call, day + 1, call))
performances_per_day = set(range(performance, day + 1, performance))
ans = len(calls_per_day & performances_per_day)
print(ans)


(m, n, z) = input().split()
(m, n, z) = (int(m), int(n), int(z))
d = max(m, n)
bb = 1
for i in range(1, d + 1):
	if m % i == 0 and n % i == 0:
		bb = i
kk = int(m * n / bb)
print(int(z // kk))


(n, m, z) = map(int, input().split())
i = 0
dict1 = dict()
dict2 = dict()
a = n
b = m
x = z // n
y = z // m
i = 0
for i in range(x):
	dict1[i] = n
	n = n + a
for j in range(y):
	dict2[j] = m
	m = m + b
print(len(set(dict1.values()) & set(dict2.values())))


(n, m, z) = map(int, input().split())
from fractions import gcd
g = gcd(n, m)
lcm = n * m // g
print(z // lcm)


(a, b, c) = map(int, input().split())
a1 = a
b1 = b
while a != 0 and b != 0:
	if a > b:
		a = a % b
	else:
		b = b % a
x = a + b
print(c // (a1 * b1 // x))


x = [int(i) for i in input().split()]

def gcd(a, b):
	while b > 0:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b / gcd(a, b)
t = x[2] // lcm(x[0], x[1])
print(int(t))


def problem(n, m, z):
	multiples_of_n = list(range(n, z + 1, n))
	multiples_of_m = list(range(m, z + 1, m))
	common_multiples = [e for e in multiples_of_m if e in multiples_of_n]
	return len(common_multiples)

def test():
	assert problem(1, 1, 10) == 10
	assert problem(1, 2, 5) == 2
	assert problem(2, 3, 9) == 1

def main():
	[n, m, z] = map(int, input().split(' '))
	print(problem(n, m, z))
main()


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b / gcd(a, b)
lst = [int(i) for i in input().split()]
(n, m, z) = (lst[0], lst[1], lst[2])
print(int(lst[2] // lcm(lst[1], lst[0])))


temp = [int(x) for x in input().split()]

def compute_lcm(x, y):
	if x > y:
		greater = x
	else:
		greater = y
	while True:
		if greater % x == 0 and greater % y == 0:
			lcm = greater
			break
		greater += 1
	return lcm
n = temp[0]
m = temp[1]
z = temp[2]
x = compute_lcm(n, m)
print(z // x)


import math
(n, m, z) = [int(s) for s in input().split(' ')]
lcm = n * m / math.gcd(n, m)
print(round(z // lcm))


import math

def lcm(x, y):
	t = math.gcd(x, y)
	if t:
		return x // t * y
	else:
		return 0
(n, m, z) = map(int, input().split())
print(z // lcm(n, m))


import math

def gcd(a, b):
	if not a == 0:
		return gcd(b % a, a)
	else:
		return b
(a, b, c) = [int(x) for x in input().split()]
lowest = gcd(a, b)
kpk = int(a * b / lowest)
print(math.floor(c / kpk))


a = input().split()
n = int(a[0])
m = int(a[1])
z = int(a[2])

def nod(a, b):
	while b > 0 and a != b:
		(a, b) = (b, a % b)
	return a
s = n * m // nod(n, m) if n > m else n * m // nod(m, n)
print(str(z // s))


(n, m, z) = [int(i) for i in input().split()]
copy_n = n
copy_m = m
x = 1
cnt = 0
while x <= z:
	if n == x:
		n += copy_n
		if m == x:
			m += copy_m
			cnt += 1
			x += 1
			continue
	if x == m:
		m += copy_m
	x += 1
print(cnt)


(n, m, z) = map(int, input().split())
(x, y) = ([], [])
for i in range(1, z // n + 1):
	x.append(n * i)
for i in range(1, z // m + 1):
	y.append(m * i)
l = set(x) & set(y)
print(len(l))


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import Decimal
from decimal import *
from collections import defaultdict, deque
import heapq
from decimal import Decimal
getcontext().prec = 25
abcd = 'abcdefghijklmnopqrstuvwxyz'
MOD = 1000000007
BUFSIZE = 8192
from bisect import bisect_left, bisect_right

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k, z) = map(int, input().split(' '))
v = n * k // math.gcd(n, k)
print(z // v)


def f(a, b):
	if a >= b:
		tmp = a
		a = b
		b = tmp
	if b % a == 0:
		return a
	else:
		return f(b % a, a)
a = list(map(int, input().split()))
n = a[0]
m = a[1]
z = a[2]
k = n * m // f(n, m)
print(z // k)


(x, y, z) = map(int, input().split())
t = 0
a = list()
b = list()
for i in range(1, z + 1):
	if x * i <= z:
		a.append(x * i)
	if y * i <= z:
		b.append(y * i)
print(len(list(set(b) & set(a))))


def lcm(x, y):
	(x, y) = (max(x, y), min(x, y))
	for i in range(1, y + 1):
		if x * i % y == 0:
			return x * i
(n, m, z) = list(map(int, input().split()))
x = lcm(n, m)
print(z // x)


def nod(a, b):
	while a != b:
		(a, b) = (min(a, b), abs(a - b))
	return a

def nok(a, b):
	return a * b // nod(a, b)
(n, m, z) = [int(x) for x in input().split()]
print(z // nok(n, m))


(n, s, d) = map(int, input().split())
q = []
w = []
z = 0
for i in range(1, d // n + 1):
	q.append(n * i)
for i in range(1, d // s + 1):
	w.append(s * i)
for i in w:
	if i in q:
		z = z + 1
print(z)


(n, m, z) = map(int, input().split())
(L1, L2) = ([], [])
(i, j) = (1, 1)
cn = 0
while n * i <= z:
	L1.append(n * i)
	i += 1
while m * j <= z:
	L2.append(m * j)
	j += 1
for c in L1:
	if c in L2:
		cn += 1
print(cn)


text = input().split()
n = int(text[0])
m = int(text[1])
z = int(text[2])
a = n
b = m
while a != 0:
	na = b % a
	nb = a
	a = na
	b = nb
nok = int(n * m / b)
otv = int(z / nok)
print(otv)


(n, m, z) = map(int, input().split())
ans = 0
nn = []
mm = []
cnt = 1
while n * cnt <= z:
	nn.append(n * cnt)
	cnt += 1
cnt2 = 1
while m * cnt2 <= z:
	mm.append(m * cnt2)
	cnt2 += 1
for i in nn:
	if i in mm:
		ans += 1
print(ans)


(n, m, z) = [int(s) for s in input().split()]
call = [int(i) for i in range(z + 1)]
call = call[::n]
artist = [int(i) for i in range(z + 1)]
artist = artist[::m]
dead = 0
for i in range(len(call)):
	if call[i] in artist:
		dead += 1
print(dead - 1)


(n, m, z) = map(int, input().split())

def pgcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a
d = pgcd(n, m)
a = n * m // pgcd(n, m)
print(z // a)


(n, m, z) = map(int, input().split())
k = m
count = 0
i = n
while i <= z:
	if i == k:
		count += 1
	if k < i:
		k += m
	elif i < k:
		i += n
	else:
		k += m
		i += n
print(count)


(a, b, c) = map(int, input().split())
x = []
y = []
i = 1
while 1:
	if a * i <= c:
		x.append(a * i)
	else:
		break
	i += 1
i = 1
while 1:
	if b * i <= c:
		y.append(b * i)
	else:
		break
	i += 1
p = 0
for i in x:
	if i in y:
		p += 1
print(p)


import fractions
(a, b, c) = map(int, input().split())
lcm = a * b // fractions.gcd(a, b)
print(c // lcm)


(n, m, z) = map(int, input().split())
i = 1
c = 0
for i in range(0, z + 1, n):
	if i == 0:
		continue
	if i % m == 0:
		c += 1
print(c)


qwerty = input()
p = [int(i) for i in qwerty.split(' ')]
q = 0
for i in range(1, p[2] + 1):
	if i % p[1] == 0 and i % p[0] == 0:
		q += 1
print(q)


import sys
input_list = [int(x) for x in sys.stdin.readline().split()]
tmp_list = input_list[:]
tel = []
act = []
while tmp_list[0] <= input_list[2]:
	tel = tel + [tmp_list[0]]
	tmp_list[0] = tmp_list[0] + input_list[0]
while tmp_list[1] <= input_list[2]:
	act = act + [tmp_list[1]]
	tmp_list[1] = tmp_list[1] + input_list[1]
print(len(set(tel) & set(act)))


(n, m, z) = map(int, input().split())

def compute_lcm(x, y):
	if x > y:
		greater = x
	else:
		greater = y
	while True:
		if greater % x == 0 and greater % y == 0:
			lcm = greater
			break
		greater += 1
	return lcm
print(z // compute_lcm(n, m))