#include #include #include #include //#include #include #include #include #include #include //#include #include #include #include //#include #include #include //#include #include #include #include #include const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; using namespace std; typedef long long ll; typedef vector vi; typedef vector vll; typedef pair pii; int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; if (N < 9) { if (N == 6) cout << 3 << endl; if (N == 8) cout << 4 << endl; return 0; } for (ll i = 3; i*i <= N; i++) { if (N%i == 0) { cout << i << endl; return 0; } } cout << N << endl; return 0; }