#include "bits/stdc++.h" using namespace std; using ll = long long; using ld = long double; using P = pair; constexpr ld EPS = 1e-12; constexpr int INF = numeric_limits::max() / 2; constexpr int MOD = 1e9 + 7; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; set st; for (ll i = 3; i * i <= N; i++) { if (N % i == 0) { st.insert(i); st.insert(N / i); } } st.insert(N); cout << (*st.begin()) << endl; }