import collections
import functools
import itertools
import math
import operator


def factorize(n):
    step = lambda x: 1 + (x << 2) - ((x >> 1) << 1)
    maxq = int(math.floor(math.sqrt(n)))
    d = 1
    q = n % 2 == 0 and 2 or 3
    while q <= maxq and n % q != 0:
        q = step(d)
        d += 1
    return q <= maxq and [q] + factorize(n // q) or [n]


def divisors(n):
    factors = collections.Counter(factorize(n))
    ks = list(factors.keys())
    for l in itertools.product(*[range(v + 1) for v in factors.values()]):
        yield functools.reduce(operator.mul, (ks[i] ** l[i] for i in range(len(ks))))


def solve():
    N = int(input())
    ds = divisors(N)
    ds = sorted(ds)

    for d in ds:
        if d > 2 and N % d == 0:
            print(d)
            return


if __name__ == '__main__':
    solve()