# -*- coding: utf-8 -*- n = int(input()) while n%2==0: n //= 2 for i in range(3,n+1): if n%i==0: print(i) break