#include using namespace std; bool isPrime(long long x){ if(x <= 1) return false; if(x == 2) return true; if(!(x % 2)) return false; for(long long i = 3;i * i < x;i += 2) if(!(x % i)) return false; return true; } int main(){ long long n; cin >> n; int i = n & 1 ? 3 : 4; if(n % 2 == 0) n /= 2; if(n % 2 == 0) n /= 2; if(isPrime(n)){ cout << n << endl; return 0; } for(;i * i < n;i += 2){ if(n % i == 0){ cout << i << endl; return 0; } } }