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