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