n = int(input()) table = set() i = 2 while i * i <= n: while n % i == 0: n /= i table.add(i) i += 1 if n > 1: table.append(n) ans = list(table) if len(ans) >= 2: if ans[1] == 3: print(3) elif ans[0] == 2: print(4) else: print(ans[0]) else: print([4, ans[0]][ans[0]!=2])