#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<cstring>
#include<deque>
#define UP
#define itn int
#define coder goodboy
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
int n,m;
inline bool is_prime(int n){
int temp=floor(sqrt(n));//printf("%d",n);
for (int i=2;i<=temp;i++){
if (n%i) continue;
else return false;
}
return true;
}
inline void in(){
#ifdef UP
freopen("prime.in","r",stdin);
freopen("prime.out","w",stdout);
#endif
#ifdef DDebug
freopen("a.txt","r",stdin);
#endif
scanf("%d",&n);
}
inline void deal(){
int num=floor(sqrt(n));
int ans;
for (int i=2;i<=num;i++){
if (n%i==0&&is_prime(i)){
ans=i;break;
}
}
printf("%d",n/ans);
}
int Main(){
in();
deal();
return 0;
}
int main(){;}
int goodboy=Main();