#include using namespace std; using ll = long long; int main(){ ll n; cin >> n; ll ans = 0; for(ll i = 3; i*i <= n; i++){ if(n%i==0){ ans = i; break; } } if(ans==0){ if(ans%2==0) ans = n/2; else ans = n; } cout << ans << endl; return 0; }