#include #define EM 1000000 using namespace std; using LL = long long; using P = pair; LL LINF = 1e18; int INF = 1e9; LL mod = 1e9+7; using vint = vector; using vLL = vector; using vvint = vector>; using vvLL = vector>; template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } 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) ans = N; cout << ans << endl; }