#include int main(){long long int u,i;scanf("%lld",&u);for(i=3;i*i<=u;i++)if(u%i<1)return printf("%d",i);printf("%lld",u%2?u:u/2);}