#include using namespace std; using ll = long long; using P = pair; using T = tuple; #define al(a) a.begin(), a.end() #define ral(a) a.rbegin(), a.rend() #define sz(a) (int)a.size() #define rep(i, n) for (int i = 0; i < (n); ++i) #define rrep(i, n) for (int i = 1; i <= (n); ++i) #define drep(i, n) for (int i = (n)-1; i >= 0; --i) #define db(a, b) cout << #a << ": " << a << " " << #b << ": " << b << endl; int main() { ll n; cin >> n; vector div; for (ll i = 1; i * i <= n; ++i) { if (n % i) continue; div.push_back(i); if (n / i != i) div.push_back(n / i); } sort(al(div)); for (auto d : div) { if (d > 2) { cout << d << endl; return 0; } } } // int main() { // ll n; // cin >> n; // for (ll i = 3; i * i <= n; ++i) { // if (n % i == 0) { // cout << i << endl; // return 0; // } // } // if (n % 2 == 0 && n / 2 > 2) n /= 2; // cout << n << endl; // return 0; // }