#include #include typedef long long dlong; int main(int argc, char const* argv[]) { dlong n; std::cin >> n; if (n % 4 == 0 && n % 3 != 0) { std::cout << 4 << std::endl; return 0; } dlong ans = n; dlong imax = sqrt(n); for (dlong i = 3; i <= imax; i+=2) { if (n % i == 0) { ans = i; break; } } if (ans == n && n % 2 == 0) ans /= 2; std::cout << ans << std::endl; return 0; }