# -*- coding: utf-8 -*- """ No.312 置換処理 https://yukicoder.me/problems/no/312 """ import sys from sys import stdin input = stdin.readline def calc_divisor(N): # 約数の列挙 divisors = set() for i in range(1, int(N**0.5)+1): if N % i == 0: divisors.add(i) divisors.add(N // i) return divisors def solve(N): d = calc_divisor(N) d.discard(1) d.discard(2) return min(d) def main(args): N = int(input()) ans = solve(N) print(ans) if __name__ == '__main__': main(sys.argv[1:])