#include using namespace std; typedef long long ll; int main() { ll n; cin >> n; if (n % 3 == 0) { cout << 3 << endl; return 0; } else if (n % 4 == 0) { cout << 4 << endl; return 0; } if (n % 2 == 0) { n /= 2; } for (ll i = 3;i*i <= n;i++) { if (n%i == 0) { cout << i << endl; return 0; } } cout << n << endl; return 0; }