// yukicoder 312 (http://yukicoder.me/problems/847) #include #include #define rep(i,a) for(int i=0;i<(a);++i) typedef long long ll; ll N; int main() { scanf( "%lld", &N ); ll ans = N&1?N:N/2!=2?N/2:N; for( ll i = 3; i*i <= N; ++i ) { if( N % i == 0 ) { ans = std::min( ans, std::min( i, N/i ) ); break; } } printf( "%lld\n", ans ); return 0; }