#include using namespace std; typedef long long ll; ll solve(ll N){ for(ll d=3;d*d<=N;d++){ if(N % d == 0){ return d; } } return N; } int main(){ ll N; cin >> N; cout << solve(N) << endl; return 0; }