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