#include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { ll N; cin >> N; //cout << sqrt(N) << endl; for (ll i = 3; i <= sqrt(N); i++) { if (N%i == 0) { cout << i << endl; return 0; } } if(N%2==0) cout << N/2 << endl; else cout << N << endl; }