#include using namespace std; #define rep(i, j, n) for(int i=j;i pi; template using vt = vector; template using vvt = vector>; i64 gcd(i64 n, i64 m) {return (m == 0? n : gcd(m, n % m));} i64 lcm(i64 n, i64 m) {return (n / gcd(n, m) * m);} int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}; int dy[] = {1, 0, -1, 0, 1, -1, 1, -1}; bool PrimeNumber(i64 n) { if(n < 2) return false; for(i64 i = 2; i * i <= n; ++i) { if(n % i == 0) return false; } return true; } int main() { cin.tie(0); ios::sync_with_stdio(false); i64 n; cin >> n; if(PrimeNumber(n)) return cout << n << endl, 0; for(i64 i = 3; i < n; ++i) { if(n % i == 0) return cout << i << endl, 0; } }