#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int isprime(int a){
for(int p = 1; p <= a; p++){
if(a % p == 0) return 1;
if(a % p != 0) return 0;
}
}
int main(){
LL a, max = 0;
cin >> a;
for(int i = 1; i <= a; i++){
if(a % i == 0 && i ){
if(isprime(i)) continue;
if(i >= max) max =i;
}
}
cout << max;
return 0;
}