#!/usr/bin/python from collections import defaultdict def factorize(n): res = defaultdict(int) d = 2 while d * d <= n: while n % d == 0: res[d] += 1 n /= d d += 1 if n > 1: res[n] += 1 return res n = int(raw_input()) arr = filter(lambda x: x>2, sorted(factorize(n).keys())) or [n] res = arr.pop() print res