#include #include using namespace std; int main() { long long n; cin >> n; long long ans = n; if (n % 2 == 0 && n != 4) { ans /= 2; } for (long long i = 3; i * i <= 2 * n; i++) { if (n % i == 0) { ans = min(ans, i); break; } } cout << ans << endl; return 0; }