#include using lint = long long; void solve() { lint n; std::cin >> n; lint ans = n; for (lint p = 2; p * p <= n; ++p) { if (n % p != 0) continue; if (p > 2) ans = std::min(ans, p); if (n / p > 2) ans = std::min(ans, n / p); } std::cout << ans << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }