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