f=lambda x:p*(x-1)//x

p=n=int(eval(input()))

d=2

while d*d<=n:

 if n%d==0:

  p=f(d)

  while n%d==0:n//=d

 d+=1

if n>1:p=f(n)

print(p)

p=n=int(eval(input()))

d=2

while d*d<=n:

 if n%d==0:

  p=p*(d-1)//d

  while n%d==0:n//=d

 d+=1

print(([p,p*(n-1)//n][n>1]))

f = lambda x: p * (x - 1) // x
p = n = int(eval(input()))
d = 2
while d * d <= n:
    if n % d == 0:
        p = f(d)
        while n % d == 0:
            n //= d
    d += 1
if n > 1:
    p = f(n)
print(p)

p = n = int(eval(input()))
d = 2
while d * d <= n:
    if n % d == 0:
        p = p * (d - 1) // d
        while n % d == 0:
            n //= d
    d += 1
print(([p, p * (n - 1) // n][n > 1]))

-f = lambda x: p * (x - 1) // x -        p = f(d) +        p = p * (d - 1) // d -if n > 1: -    p = f(n) -print(p) +print(([p, p * (n - 1) // n][n > 1]))