#include #include #include #include #include #include #include #include #include #include #define ALL(obj) (obj).begin(),(obj).end() #define RALL(obj) (obj).rbegin(),(obj).rend() #define P pair #define MOD 1000000007 #define INF 1012345678 #define NINF (-2147483647-1) #define LLINF 9223372036854775807 using ll = long long; using namespace std; int main() { ll N; cin >> N; priority_queue pq; for (ll i = 1; i*i <= N; i++) { if (N % i == 0) { pq.push(-i); pq.push(-N / i); } } pq.pop(); // -1をpop while (pq.top() == -2) { pq.pop(); } cout << -pq.top() << endl; getchar(); getchar(); return 0; }